开发者

How do I highlight available days in a Calendar control in WPF?

I wanted to hi开发者_开发知识库ghlight some range of days in a Calendar in WPF, and make any other day in the calendar unavailable. So the user could select only the highlighted range. The problem is, I havent found anything useful to do so yet. The control itself doesnt support data binding at all (although it has Data Context property :-)), which makes it somewhat sloppy.


To make some dates unavailable you can use Calendar.BlackoutDates property. E.g.:

DateTime today = DateTime.Today;
_calendar.BlackoutDates.Add(
    new CalendarDateRange(today.AddDays(-5), today.AddDays(-3)));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜