I am creating a form using wpf/c#. I am looking to programatically change/interpret the user’s typed input in the wpf toolkit DatePicker.
For example, the user types “Today”, and when the control looses focus the date is interpreted and set to the current date using my c# function.
Should I listen to the lostFocus event or is there a better way of changing how a typed input date is parsed?
I do not care to change the display format of the date picker. I am developing this application using the mvvm pattern.
Ok so finally I looked into the sourcecode of
DatePickerand theres not much I can do in terms of converters etc as most stuff is private and the only two available formats are “short” and “long”. Finally, I will have to create my own control, probably in part using the solution above by Aviad. However, here’s a quick temporary solution until then (whereDateHelperis my custom parser class):