How do I set TargetNullValue to a date?

Posted by Bryan Anderson on Stack Overflow See other posts from Stack Overflow or by Bryan Anderson
Published on 2009-02-05T17:56:02Z Indexed on 2010/06/08 8:42 UTC
Read the original article Hit count: 468

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?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml