Selecting the Date and Year at Run Time in WPF Calendar (CalendarEdit)

Selecting Date at Run Time

By setting the AllowSelection property to true, you can enable user selection in CalendarEdit control at run time. This dependency property indicates whether the date selection is allowed during runtime. It returns a Boolean value indicating the state of this property.

For setting the AllowSelection property, use the following code.

<!-- Adding calendar with allow selection of a date -->
<syncfusion:CalendarEdit Name="calendarEdit" AllowSelection="True"/>
//Creating an instance of CalendarEdit control
CalendarEdit calendarEdit = new CalendarEdit();

//Allow selection of a date
calendarEdit.AllowSelection = true;

//Adding calendarEdit as window content
this.Content = calendarEdit;

Date selection at run time

Selecting year at runtime

By setting the AllowYearEditing property to true, you can edit the year at run time. This is dependency property indicates whether the year can be edited at run time. It returns the Boolean value that indicates the state of this property.

To set the AllowYearEditing property, use the following code.

<!-- Setting AllowYearEditing property-->
<syncfusion:CalendarEdit Name="calendarEdit" AllowYearEditing="True"/>
//Creating an instance of CalendarEdit control
CalendarEdit calendarEdit = new CalendarEdit();

//Allow selection of year
calendarEdit.AllowYearEditing = true;

//Adding CalendarEdit as window content
this.Content = calendarEdit;

Selecting year at run time

See Also

Selecting Multiple Dates, Scrolling to the Selected Date