Hello,
I have a XamDateTimeInput. Its value controls whether or not an action can be applied. I would like to only be able to apply the action IF the DateTime from the input is valid. I have played with setting different InvalidValueBehaviors, but none really do what i want. For example, if i highlight the date in the control and press delete, the XamDateTimeInput turns red to tell me that it is not a valid date. However, the Date i have bound to it is not updated and stays with the original value. This lets my Apply button function, even though, to the user, it LOOKS like there is an invalid date. This is with the InvalidValueBehavior set to "Default". Also, if i manually type 02/31/2013 (an invalid date) and then click Apply, i see the error pop up stating the date is not valid. But if i hit enter again, the date has become 2/3/2013, and is therefore a valid date. I tried changing InvalidValueBehavior to "Revert Value" and this doesn't quite work either. If i type 2/31/2013, the value is reverted, allowing my Apply method. But if i hit "delete" after highlighting the entry, it appears to the user there is no date but the underlying data is still a valid date, and Apply is able to happen. How can i keep the display of the control and the bound property in harmony and keep the user from getting confused about all this? I included a sample project that illustrates this simply. You may need to change the InvalidValueBehavior to see what each scenario does.
Hello Travis,
I am just checking if you require any further assistance on the matter.
I'm experiencing the exact same issue, however, I cannot use a nullable DateTime, as our binding is actually a string (we are using a DataGrid with a template selector to treat a string as a string, number, date, etc ...).
So on deleting the string, we get an invalid date time, but when we click out of the editor, the time is replaced with DateTime.Now.