I'm using the WPF toolkit's Calendar control to allow users to select a date. If the date is not yet selected then the property the SelectedDate is bound to is Null. This makes the Calendar default you January 1, 0 AD. I'd like to do something like
SelectedDate="{Binding UserPickedDate, TargetNullValue=Today, Mode=TwoWay}"
But both "Today" and "Now" throw binding errors. Can I use TargetNullValue to set the default date to Today or Now?
Try this:
xmlns:sys="clr-namespace:System;assembly=mscorlib"
...
TargetNullValue={x:Static sys:DateTime.Now}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With