New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms Calendar

This tutorial will demonstrate adding selected and special days to the calendar at design time, then iterating and displaying those dates at runtime.WinForms RadCalendar Getting Started

  1. In a new Windows Application form drop a RadCalendar control. Set the AllowMultipleSelect property to true.

  2. Drop a RadListControl and RadButton to the form.

  3. In the Properties window click the ellipses for the SelectedDates property of the RadCalendar.

  4. 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.

  5. Add two more selected dates and set their Value properties to the two days following "Today". WinForms RadCalendar Getting Started Selected Datess

  6. In the Properties window click the ellipses for the SpecialDays property of the RadCalendar.

  7. Click the Add button to append a new RadCalendarDay to the collection.

  8. Set the Date property for the special day to the last day of the month.WinForms RadCalendar Date Property

  9. Set the Disabled property to true and the Recurring property to DayInMonth. WinForms RadCalendar Getting Started Disabled Recurring

  10. 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.

Iterating the SelectedDates and SpecialDates collections

private void radButton1_Click(object sender, EventArgs e)
{
    foreach (DateTime dateTime in radCalendar1.SelectedDates)
    {
        radListControl1.Items.Add(
          new RadListDataItem("Selected: " + dateTime.ToShortDateString()));
    }
    foreach (RadCalendarDay day in radCalendar1.SpecialDays)
    {
        radListControl1.Items.Add(
          new RadListDataItem("Special: " + day.Date.ToShortDateString()));
    }
}

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()))
    Next
    For Each day As RadCalendarDay In RadCalendar1.SpecialDays
        RadListControl1.Items.Add(New RadListDataItem("Special: " + day.[Date].ToShortDateString()))
    Next
End Sub

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.

RELATED VIDEOS
WinForms RadCalendar 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) WinForms RadCalendar calendar-getting-started 005

See Also

Telerik UI for WinForms Learning Resources

In this article