When View.xaml shown "IfNullConverter" is used to convert default DateTime value "01.01.0001" to DateTime.Now, so DatePicker displays current date. But actually the SelectedDate property is not set. Why?

When I press Save button, the DatePicker value passed to ViewModel is still "01.01.0001".

Please help, what am I doing wrong? How do I update my source code to pass current date if the date is "01.01.0001"?

1 Answer
1

This is the right behavior. You should use converter when you want to convert the source value( Date in VM) and then set desdination(SelectedDate) with the new value. Which means that when you convert the source value, the result doesnt affect it, just the destination.
Conclusion : if you want to set a default value DateTime.Now to your property, you should do it in your VM