How to highlight available days in a calendar control in WPF?

I wanted to highlight a few days on the calendar in WPF and make any other day on the calendar inaccessible. Thus, the user can select only the selected range. The problem is that I have not yet found anything useful. The control itself does not support data binding at all (although it has the Data Context :-) property), which makes it somewhat inaccurate.

+3
source share
1 answer

To make some dates inaccessible, you can use the property Calendar.BlackoutDates. For instance:.

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

Source: https://habr.com/ru/post/1745854/


All Articles