Reputation: 5394
ERROR: .ArgumentException: The value representation '3/7/2021' does not match the mask.
I am using the MaskedTextBox (from xceed wpftoolkit). I would like the user to input and see a clean date as "__/__/____"
in typical US fashion as MM/dd/yyyy.
The following works correctly for "3/7/2021",
<xceed:MaskedTextBox Width="240" FontSize="28" IncludeLiteralsInValue="True" Value="{Binding EffectiveDateFrom, UpdateSourceTrigger=LostFocus}" ValueDataType="{x:Type s:DateTime}" Mask="0/0/0000" />
but fails when the mask is changed to
Mask="00/00/0000"
So how is a mask written that will allow for both dates as "12/30/1999" or "3/7/2021" ?
Thank you for any help on this. (Note: I am not opposed to any solution: I have seen some suggestions to use the DatePicker instead. Any thoughts?)
TIA
Upvotes: 0
Views: 946
Reputation: 3168
According to their documentation what you want is: 90/90/0000
If you use #0/#0/0000 you would have to type the leading spaces!
HTH
Upvotes: 0