blazor-devexpress-dot-blazor-dot-dxcalendar-1-b1b33ad3.md
Specifies available calendar views and selectable date units.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public CalendarViewMode ViewMode { get; set; }
| Type | Description |
|---|---|
| CalendarViewMode |
An enumeration value.
|
Available values:
| Name | Description |
|---|---|
| Month |
This component displays all views ( Month , Year , Decade ). Users can select days, months, and years.
| | Year |
This component hides the Month view. Users can select months and years in Year and Decade views.
| | Decade |
This component hides Month and Year views. Users can select years in the Decade view.
|
You can use the ViewMode property to hide certain views and implement the following scenarios:
The following example hides the Month view and limits selection to a month/year combination:
<DxCalendar T="DateTime" ViewMode="CalendarViewMode.Year" />
When day selection or day/month selection is disabled, the Calendar component selects the first day of a chosen month or year. You can update your business object value as your needs dictate. In the following code snippet, the component passes the 15th day of a month to a business object:
<DxCalendar T="DateTime"
ViewMode="CalendarViewMode.Year"
@bind-SelectedDate="@SelectedDate" />
Selected Date: <b>@date</b>
@code {
DateTime date; // Business object
DateTime SelectedDate {
get
{
return new DateTime(date.Year, date.Month, 1);
}
set
{
date = new DateTime(value.Year, value.Month, 15);
}
}
}
See Also