Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SchedulerViewInfo Class

Stores information about a Scheduler’s view.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public class SchedulerViewInfo

#Remarks

A SchedulerViewInfo object is passed as the context parameter to the DateNavigatorTextTemplate. This template allows you to customize text displayed in the Date Navigator.

The following code hides the month/year part for a start date in a date range if start and end dates have the same month/year.

@using MyProject.Services

<DxScheduler DataStorage="@DataStorage">
    <Views>
        <DxSchedulerWeekView ShowWorkTimeOnly="true" />
        <DxSchedulerWorkWeekView ShowWorkTimeOnly="true" />
        <DxSchedulerMonthView />
    </Views>
    <DateNavigatorTextTemplate><span>@CalculateDateString(context)</span></DateNavigatorTextTemplate>
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
            AppointmentsSource = AppointmentCollection.GetAppointments(),
            AppointmentMappings = new DxSchedulerAppointmentMappings() {
                Type = "AppointmentType",
                Start = "StartDate",
                End = "EndDate",
                Subject = "Caption",
                AllDay = "AllDay",
                LabelId = "Label",
                StatusId = "Status",
                RecurrenceInfo = "Recurrence"
            }
        };

    string CalculateDateString(SchedulerViewInfo viewInfo) {
        if (viewInfo.ActiveViewType == SchedulerViewType.Month) {
            return viewInfo.VisibleTimeRange.Start.ToString("MMM yyyy");
        }
        else {
            if (viewInfo.VisibleTimeRange.End - viewInfo.VisibleTimeRange.Start < TimeSpan.FromDays(1)) {
                return viewInfo.VisibleTimeRange.Start.ToString("dd MMM yyyy");
            }
            else {
                if (viewInfo.VisibleTimeRange.Start.Year != viewInfo.VisibleTimeRange.End.Year)
                    return viewInfo.VisibleTimeRange.Start.ToString("dd MMM yyyy") + " - " + viewInfo.VisibleTimeRange.End.ToString("dd MMM yyyy");
                else {
                    if (viewInfo.VisibleTimeRange.Start.Month != viewInfo.VisibleTimeRange.End.Month)
                        return viewInfo.VisibleTimeRange.Start.ToString("dd MMM") + " - " + viewInfo.VisibleTimeRange.End.ToString("dd MMM yyyy");
                    else
                        return viewInfo.VisibleTimeRange.Start.ToString("dd") + " - " + viewInfo.VisibleTimeRange.End.ToString("dd MMM yyyy");
                }
            }
        }
    }
}

Scheduler - Custom Close Button

#Inheritance

Object
SchedulerViewInfo
See Also