Hy all.
I have a question about the XamDateTimeEditor control.
I have a simple wpf application with a form for which I set the DataContext to a Controller class.
In this Controller class I have an object that has two properties. The DateTime property (DateValue) it's bounded to the XamDateTimeEditor value and the string property (TextValue) it's bounded to a TextBox control.
I have noticed that every time when the XamDateTimeEditor gets the focus, it will call the set method for the DateValue of the object even if the DateValue was not changed. For the TextBox control it will call the set method of the TextValue property only after losing the focus on the control.
Do you know if I must do something so that the XamDateTimeEditor will not call the set method when it gets the focus? I have also attached a sample.
Thanks a lot.
Nico
Hello Nico,
I am not sure why the XamDateTimeEditor behaves like this, maybe someone else can answer this question for me, but I cannot see the behavior you describe for the TextBox. It does not fire anything if you have not changed the value.
Regarding the Set, you can use the following to make sure that the value will be set only if it is changed:
set
{
if (this.dateValue != value)
this.dateValue = value;
NotifyPropertyChanged("DateValue");
}
Hope this helps.
Hello Alex.
I have added also this check in the set of the property. But can you please add a break point in the set methods for DataValue and TextValue to see different behavior.
For the XamDateTimeEditor it goes in the set method when the control gets the focus, but for the TextBox control not.
Thanks very much for help.