WPF DatePicker
默认弹出当前日期
<HeaderedContentControl Header="默认弹出当前日期"> <StackPanel> <DatePicker/> </StackPanel> </HeaderedContentControl>
默认弹出指定日期
<HeaderedContentControl Header="默认弹出指定日期"> <StackPanel> <DatePicker DisplayDate="2024-06-06"/> </StackPanel> </HeaderedContentControl>
默认选定指定日期
<HeaderedContentControl Header="默认选定指定日期"> <StackPanel> <DatePicker SelectedDate="2024-06-06"></DatePicker> </StackPanel> </HeaderedContentControl>
选定日期格式
<HeaderedContentControl Header="选定日期格式"> <StackPanel> <DatePicker SelectedDate="2024-06-06" SelectedDateFormat="Short"></DatePicker> </StackPanel> </HeaderedContentControl>
日期限制
<HeaderedContentControl Header="日期限制"> <StackPanel> <DatePicker> <DatePicker.BlackoutDates> <!--日期限制不能选定--> <CalendarDateRange Start="2024-01-01" End="2024-06-07" /> </DatePicker.BlackoutDates> </DatePicker> </StackPanel> </HeaderedContentControl>