Issue with IDataErrorInfo with text box in Expander - wpf

I have one expander and which contain text box, text is validating through IDataErrorInfo, it is working fine when i enter wrong information, it popup with red rectangle.
but issue arises when i tried to collase the expander, and red rectangle is still there. it stayed on Expander
so please provide soem good solution....

Another solution is to create a control template where you wrap the contentpresenter element in an adorner decorator. This prevents the validation escaping the closed expander.

Related

Multiline Combobox Control in WPF

I would like to build a multiline combobox in WPF. This would be similar to label control wherein the width of control will grow such that entire selected text is visible. The text displayed can go over next line if there is no enough space available on current line.
I tried few things around control template of combobox. But still no success.
Below is sample screenshot of how it should look like!
Any pointers?
Thanks,
Sambhaji
As per my understanding setting the control template for this particular scenario would be a tedious job. I would have created a TextBlock and tried setting the event triggers which will open a container on mouse hover or click event.

Silverlight toolkit Expander doesn't expand when the size of its content changes

I have a silverlight expander control which wraps a grid. In the grid, I have a number of text boxes, combo boxes as well as some invisable (collapsed) text blocks. I also have an animation and when it is triggered the grid shows those hidden text blocks.
My problem is, when the hidden text blocks are shown after the animation is run, these text blocks push other controls down and because the expander doesn't resize itself, the controls at the bottom get pushed outside of the expander and become invisible.
I tried to call UpdateLayout() after the SizeChanged event of the grid but doesn't work.
Any suggestions on how to resolve this issue would be much appreciated!!
I actually have fixed this problem by myself. I discovered in the style of the expander control, a while ago I put an ExpandableContentControl instead of normal ContentControl because it has a nice animation when you expand/collpase it. But this control doesn't resize properly... (see http://silverlight.codeplex.com/workitem/4544?ProjectName=silverlight) I guess this is why the AccordionItem control is so buggy because it also has an ExpandableContentControl in it. As soon as I replaced the ExpandableContentControl with a normal ContentControl, the expander worked as expected. :)
The problems is because the expander always use the same width (or height), so you must recalculate the width of the grid by code and assign it to the columndefinition.

AutoCompleteBox Dropdown width

Can the width of the dropdown be set to a different value than the AutoCompleteBox itself?
The Popup is a separate Part of the AutoCompleteBox, so it should be possible to extend that beyond the width of the text box.
In Blend, right-click on the AutoCompleteBox and select Edit Template > Edit a Copy, giving the new template a name.
Drill-down in the Objects and Timeline window to the 'Popup' part, and beneath that is a Grid. Change the width of that Grid to change the width of the popup content whilst maintaining the current width of the text box).
(I must admit I've only had chance to do this in Silverlight Spy, but it definitely works there so I can't see it being a problem doing it through Blend).
If you are not using Blend, just copy Default Style and Template of AutocompleteBox from MSDN and paste it into your App.xaml file (here is little tutorial on how to handle styles in app.xaml).
You can then modify that pasted style or template.

How can i right click in a WPF Popup without it losing focus

I have a text box that has spell check enabled. It is inside a popup. This enables me to edit multi line text in a datagrid, when the text is being edited the text box it is in grows over the top of the grid instead of resizing the height of the row.
The problem is that when the red squiggly lines appear to indicate a spelling mistake i cant right click on them, because when i do the popup closes.
I have tried Popup.StaysOpen but to no avail. any ideas?
Have you tried this outside the context of the DataGrid? I have a hunch that it is most likely the DataGrid detecting that focus has been lost and is automatically applying your edits, changing the template for the cell and thus closing your Popup.

Change the position of the textbox validation

The new data validation in silverlight 3 has a red textbox that flies out to the right. This is a problem for me because I have have a textbox to the right that is getting covered by the popup.
How can I make this popup move somewhere else?
Retemplate the textbox. The tooltip is found in there. You can modify it using the placement property or margins to appear elsewhere.

Resources