Hello,
I am using xamDateTimeEditor in a MVVM application. So, the xamDateTimeEditor is standalone and TwoWay binded to a datetime property in my viewModel. When the xamDateTimeEditor gets focused, it throws an StackOverflowException. Here is my code :
<
igEditors:XamDateTimeEditor x:Name="myDateTimeEditor" Value="{Binding myDate}"/>
When i remove this line it works. Am I doing something wrong? Thank you for your help.
Can you provide a sample that demonstrates the issue? if not can you provide more information on how we might reproduce the problem or can you provide some portion of the callstack from the stack overflow?
I have reproduced the issue. The visual studio 2008 solution is join.
Thank you for your help
hello,
I just want to know if i have missed anything or if it is xamDateTimeEditor which do not work with what i did?
kind regards
Sorry. I was able to reproduce the issue with your sample but it seems like it's ultimately a bug in the WPF framework relating to focus scopes. I was able to strip down your sample such that it doesn't use any of our stuff. Basically since you are setting the Content of the UserControl to an element (a stackpanel in this case), that Content becomes a logical child of the UserControl. When an element is in a focusscope and its logical parent is in a different focus scope the wpf framework gets into this state and causes the stackoverflowexception.
In your original case the focusscope is the ContentPane. That contentpane ultimately contains the Content of the usercontrol because your default template for your UserControl contains the dockmanager which contains the contentpane and the contentpane's content is bound to the content of the usercontrol. The only workarounds I can think of are to set the FocusManager.IsFocusScope of the ContentPane to false or to override OnContentChanged of the usercontrol and don't call the base implementation so it doesn't get added as a logical child and override the LogicalChildren so it returns an empty enumerator.
There are downsides to both I would think. The ContentPane expects and is tested as being a focus scope so you could hit issues later with it not being a focus scope. With the other approach, the UserControl may assume its Content is a logical child (as it does in the logicalchildren which is why you need to override that as well).
I've attached a modified version of your sample which takes the latter approach. If you run the application as is and click the button you will get the exception. If you go to UserControlWithAButton and uncomment the OnContentChanged and LogicalChildren overrides and rerun it the problem doesn't happen.
Hi, I'm also using an old version - infragistics3.wpf.editors.v9.2.dll.
Unfortunately i don't see this download . Can you please refer me where i can download it.
Thank you in advance
Thank you very much for your answer, it has solved my problem. I did not understand that it was not a problem with your component. Sorry.
Best regards.