This tutorial will demonstrate adding selected and special days to the calendar at design time, then iterating and displaying those dates at runtime.
In a new Windows Application form drop a RadCalendar control. Set the AllowMultipleSelect property to true.
Drop a RadListControl and RadButton to the form.
In the Properties Window click the ellipses for the SelectedDates property of the RadCalendar.
Click the Add button to append a new selected date to the collection. In the Value property for the date select "Today" from the drop-down calendar.
Add two more selected dates and set the Value properties to the two days following "Today".
In the Properties Window click the ellipses for the SpecialDays property of the RadCalendar.
Click the Add button to append a new RadCalendarDay to the collection.
Set the Date property for the special day to the last day of the month.
Set the Disabled property to true and the Recurring property to DayInMonth.
Double-Click the RadButton in the designer and add the following code to the Click event handler. This code will iterate and list results for the SelectedDates and SpecialDays collections.
[C#] Iterating the SelectedDates and SpecialDates collections
private void radButton1_Click(object sender, EventArgs e)
foreach (DateTime dateTime in radCalendar1.SelectedDates)
new RadListDataItem("Selected: " + dateTime.ToShortDateString()));
foreach (RadCalendarDay day in radCalendar1.SpecialDays)
new RadListDataItem("Special: " + day.Date.ToShortDateString()));
[VB.NET] Iterating the SelectedDates and SpecialDates collections
Private Sub radButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
For Each dateTime As DateTime In radCalendar1.SelectedDates
radListControl1.Items.Add(New RadListDataItem("Selected: " + dateTime.ToShortDateString()))
For Each day As RadCalendarDay In radCalendar1.SpecialDays
radListControl1.Items.Add(New RadListDataItem("Special: " + day.[Date].ToShortDateString()))
Run the application. Notice the three selected and the highlighted special day. Use the navigation buttons at the top of the calendar ">" to move to another month. Because you set the special day Recurring property to DayInMonth, the special day is highlighted in every month.
|Using RadCalendar for WinForms|
In this video, you'll get an overview of using RadCalendar for WinForms; configuring important properties; using Special Days and Selected Days; styling; responding to Events with style changes. (Runtime: 10:23)