问题
I got two datepicker in my WPF canvas. What i trying to do is like the datepicker from airline website. The first calendar allow user to pick the departure date and the second calendar allow user to pick the return date. Let say i select 11/11/2012 from datapickerA, when i click on the second datepickerB, the dates before 11/11/2012 are disabled. What should i put in the datepicker?
回答1:
You can use the DisplayDateStart property of the DatePicker. It is a DependencyProperty, so you can supply it via your DataContext using MVVM, or by setting DisplayDateStart of your second DatePicker to SelectedDate from the first DatePicker:
<DatePicker x:Name="Date1"/>
<DatePicker DisplayDateStart="{Binding ElementName=Date1, Path=SelectedDate}"/>
来源:https://stackoverflow.com/questions/13576963/wpf-datepicker-date-from-and-date-to