How to set TargetNullValue to a date?

I use the WPF calendar control panel so that users can select a date. If the date has not yet been selected, then the SelectedDate property is bound to Null. This makes the default calendar January 1, 0 AD. I would 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 for Today or Now?

+5
wpf calendar xaml wpftoolkit targetnullvalue
source share
1 answer

Try the following:

 xmlns:sys="clr-namespace:System;assembly=mscorlib" ... TargetNullValue={x:Static sys:DateTime.Now} 
+12
source share

All Articles