What is the best way to have a WPF DatePicker
show a predefined DateTime
(e.g. DateTime.Today
) while still maintaining binding?
SelectedDate="{x:Static sys:DateTime.Today}"
and
Text="{Binding Path=MyPublicProperty.ADateTimeMemberProperty, Mode=TwoWay}"
don't play well together. When a UserControl
is loaded, I'd like it to display today's date, until a row is selected. Is there a way to make them get along?
Text="{Binding Path=MyPublicProperty.ADateTimeMemberProperty,
Mode=TwoWay, FallbackValue={x:Static sys:DateTime.Today}}"
Use FallbackValue to set a value when it cannot be retrieved from the binding.
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