WPF日期选择器显示日期时间。今天或绑定
让WPFWPF日期选择器显示日期时间。今天或绑定,wpf,xaml,data-binding,datepicker,Wpf,Xaml,Data Binding,Datepicker,让WPFDatePicker在保持绑定的同时显示预定义的DateTime(例如DateTime.Today)的最佳方法是什么 SelectedDate=“{x:Static sys:DateTime.Today}” 及 Text=“{Binding Path=MyPublicProperty.ADateTimeMemberProperty,Mode=TwoWay}” 一起玩得不好。加载UserControl时,我希望它显示今天的日期,直到选中一行。有没有办法让他们和睦相处 Text="{Bind
DatePicker
在保持绑定的同时显示预定义的DateTime
(例如DateTime.Today
)的最佳方法是什么
SelectedDate=“{x:Static sys:DateTime.Today}”
及
Text=“{Binding Path=MyPublicProperty.ADateTimeMemberProperty,Mode=TwoWay}”
一起玩得不好。加载UserControl
时,我希望它显示今天的日期,直到选中一行。有没有办法让他们和睦相处
Text="{Binding Path=MyPublicProperty.ADateTimeMemberProperty,
Mode=TwoWay, FallbackValue={x:Static sys:DateTime.Today}}"
当无法从绑定中检索某个值时,请使用FallbackValue设置该值