Selection Range in WPF Calendar (CalendarEdit)
You can set the selection range mode for CalendarEdit control in two different ways, using the SelectionRangeMode property. They are as follows.
- CurrentMonth: selects only days, belonging to the current month from the column
- WholeColumn: selects the whole column
For setting the selection range mode, use the following code.
<!-- Adding CalendarEdit with selection range mode -->
<syncfusion:CalendarEdit Name="calendarEdit" SelectionRangeMode="WholeColumn"/>
//Creating an instance of CalendarEdit control
CalendarEdit calendarEdit = new CalendarEdit();
//Sets selection range mode as whole column
calendarEdit.SelectionRangeMode = SelectionRangeMode.WholeColumn;
//Adding CalendarEdit as window content
this.Content = calendarEdit;
Block particular dates
You can restrict the user to select the dates within some range by blocking the particular dates in the CalendarEdit
. You can also block the more date ranges by adding that date ranges into the BlackoutDates collection.
<syncfusion:CalendarEdit x:Name="calendarEdit">
<syncfusion:CalendarEdit.BlackoutDates>
<syncfusion:BlackoutDatesRange StartDate="1/01/2020" EndDate="1/10/2020"/>
<syncfusion:BlackoutDatesRange StartDate="5/01/2020" EndDate="{x:Static system:DateTime.Today}"/>
</syncfusion:CalendarEdit.BlackoutDates>
</syncfusion:CalendarEdit>
NOTE
View Sample in GitHub
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page