Calendar for WinForms | ComponentOne
In This Topic
    Customization
    In This Topic

    DateEdit allows you to customize the dropdown calendar to show a limited set of days in the visible calendar month and display multiple calendar months at a time. Let us dive into the details of how to achieve these in the following section.

    Set DateRange

    DateEdit lets you to customize the dropdown calendar to show a limited set of days in the visible calendar month and restrict the selection to the specified range of dates from the calendar.

    You can specify minimum and maximum dates to prevent users from selecting a date and time in a particular range. Setting a minimum date helps you to restrict the date value that is set less than the specific value. Likewise, setting a maximum date helps you to restrict the date value that is set greater than the specific value.

    In the image below, the minimum and maximum date has been set (to 01/03/2021 and 25/03/2021 respectively). As you can observe all other date values outside this range are disabled, and only a particular date range can be selected.

    Users can set the minimum and maximum date values to the calendar dropdown of DateEdit control, by using the MinDate and MaxDate properties.

    The following code uses the MinDate and MaxDate properties to display the available date range for selection in the calendar:

    C#
    Copy Code
    // Set a minimum date
    dateEdit.Calendar.MinDate = new DateTime(2021, 3, 1);
    // Set a maximum date
    dateEdit.Calendar.MaxDate = new DateTime(2021, 3, 25);