Calendar for WinForms | ComponentOne
CalendarView / Behavior / Display
In This Topic
    Display
    In This Topic

    By default, CalendarView supports monthly view. CalendarView lets you display its UI in different presentations, such as multi-month view and first day of the week

    Let us explore more about these display features in the following sections.

    Multi-Month View

    CalendarView supports multi-month view that enables you to create a full-year view to see several months of calendar on the same screen at the same time. A full year view is easily visible, scanned, and understood. It also lets you make the navigation and selection seamless for users. In addition, viewing a full year at a glance can make planning long-term activities and projects easier. For instance, it is easier to view holidays in a specific year when it displays all months in the multi-month mode.

    The C1CalendarView class provides the CalendarDimensions property, which indicates the number of months that will be shown at run-time. By default, the CalendarDimensions property has a value equal to 1.

    The image below depicts a single-month (default view) CalendarView control.

    To display multiple months in CalendarView, simply set the CalendarDimensions property to a value greater than 1 and change the control dimensions. The control should show as many months as possible into the available space, depending upon the value set in CalendarDimensions.

    In the image below, the CalendarDimensions is set to a value equal to 12.

    You can set the width as per the number of columns the control needs to display. To specify the number of columns to display, you have to set the MaxColumns property.

    The code snippet below depicts how to display the complete calendar year in three columns using the CalendarDimensions and MaxColumns properties

    C#
    Copy Code
    // specify the number of months to display
    calendarView.CalendarDimensions = 12;
    // specify the maximum number of columns to display
    calendarView.MaxColumns = 3;
    // set Dock property to Fill
    calendarView.Dock = DockStyle.Fill;
    

    First Day of Week

    The CalendarView control provides the FirstDayofWeek property to assign one of the week days as the first day of the week. By default, Sunday is set as the first day of the week. But, CalendarView lets you set any day as the first day of week. For example, the following image shows Monday set as the first day of the week.

    The following code snippet shows how to use FirstDayofWeek property.

    C#
    Copy Code
    // set first day of week as Monday
    calendarView.FirstDayOfWeek = DayOfWeek.Monday;