I have a WPF application where a birthdate is required using DatePicker. I\'d like to blackout dates of tomorrow and the rest of time in addition to, say 134 years ago and every
Thanks so much for both of you quickly replying. I was actually able to figure this out using DateTime.MaxValue and DateTime.MinValue and having two CalendarDateRanges in my DatePicker.BlackoutDates tags. Sometimes you just need to post a question to think about it in a different way :) Thanks again guys. Here's my xaml:
<DatePicker>
<DatePicker.BlackoutDates>
<CalendarDateRange Start="{x:Static app:CustomDateControl.FutureMinBlackoutDate}" End="{x:Static app:CustomDateControl.FutureMaxBlackoutDate}" />
<CalendarDateRange Start="{x:Static app:CustomDateControl.PastMinBlackoutDate}" End="{x:Static app:CustomDateControl.PastMaxBlackoutDate}" />
</DatePicker.BlackoutDates>
</DatePicker>
You have to choose range for the datepicker itself, too. if you wont, so nothing will be blacked out. I think they know about this lack feature, but currently you need to give your date picker a Start date same as your blackout dates. Every other date out of the datepicker's range won't be shown at all. I think it is better for you to do that instead of blacking out dates.