I have a problem that happens when we enter invalid date into the control and tab off.
When we tab off, it fired the propertyChanged event on our bound object. During the handling of that event we may sent the objects value back to a business valid value.
When we do this, and the date entered in a valid date, but outside the scope of allowed dates for our application, the date text in the control changes to the updated date value - as expected.
When the date entered is not valid, the bound object becomes null, and so we reset the bound object to a valid datetime, but in this case, the text of the control now shows the watermark, and not the value updated date.
We tried to force a binding.updatesource on the selectedDate property. We also tried to raise a property change on the lost focus event, and still only the watermark text shows. Upon looking into the control, the selectedDate is set to the correct value, it is that the CurrentDateTimeText and DateTimeText properties are empty, thus the watermark shows.
How can the controls SelectedDate contain the value, but the text properties do not?
In the end we found a workaround: during LostFocus event on the control, we set the controls DateTimeText property to the correct string to force it in. This works, but seems like there might be a better way to handle this.
When we tab off, it fired the propertyChanged event on our bound object. During the handling of that event we may sent the objects value back to a business valid value.
When we do this, and the date entered in a valid date, but outside the scope of allowed dates for our application, the date text in the control changes to the updated date value - as expected.
When the date entered is not valid, the bound object becomes null, and so we reset the bound object to a valid datetime, but in this case, the text of the control now shows the watermark, and not the value updated date.
We tried to force a binding.updatesource on the selectedDate property. We also tried to raise a property change on the lost focus event, and still only the watermark text shows. Upon looking into the control, the selectedDate is set to the correct value, it is that the CurrentDateTimeText and DateTimeText properties are empty, thus the watermark shows.
How can the controls SelectedDate contain the value, but the text properties do not?
In the end we found a workaround: during LostFocus event on the control, we set the controls DateTimeText property to the correct string to force it in. This works, but seems like there might be a better way to handle this.