Skip to main content

SchedulerDateHeaderCellInfo Class

Stores information about a Scheduler’s header cell that displays a date.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public class SchedulerDateHeaderCellInfo

Remarks

A SchedulerDateHeaderCellInfo object is passed as the context parameter to the following templates:

The parameter’s properties allow you to specify the following:

  • The interval to which the cell belongs (Interval).
  • Resources associated with the cell (Resources).

The following example adds weather indicator images to date header cells:

    @inject WeatherForecastService ForecastService

    <DxScheduler @bind-StartDate="@StartDate" DataStorage="@DataStorage" CssClass="demo-sc-size">
        <Views>
            <DxSchedulerDayView DayCount="5" ShowWorkTimeOnly="true">
                <DateHeaderCellTemplate>
                    <div style="display: flex;">
                        <div class="dxbl-sc-date-hr-wrapper" style="width: 100%;">
                            <span class="dxbl-sc-date-hr-day">@context.Interval.Start.Day</span>
                            <span class="dxbl-sc-date-hr-week">@context.Interval.Start.ToString("ddd")</span>
                        </div>
                        @{
                            string cloudCover = GetCloudCoverByDate(context.Interval.Start);
                            if(!string.IsNullOrEmpty(cloudCover)) {
                                <span class="@string.Format("scheduler-cloud-cover-icon {0}", cloudCover)"></span>
                            }
                        }
                    </div>
                </DateHeaderCellTemplate>
            </DxSchedulerDayView>
        </Views>
    </DxScheduler>

@code {
    DateTime StartDate { get; set; } = DateTime.Today;

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

    string GetCloudCoverByDate(DateTime date) {
        foreach(WeatherForecast item in ForecastService.GetForecast())
            if(date.Day == item.Date.Day)
                return GetCloudCoverCssClass(item.CloudCover);
        return string.Empty;
    }
    string GetCloudCoverCssClass(string cloudCover) {
        switch(cloudCover) {
            case "Storm":
                return "scheduler-icon-storm";
            case "Cloudy":
                return "scheduler-icon-cloudy";
            case "Partly cloudy":
                return "scheduler-icon-partly-cloudy";
            case "Sunny":
                return "scheduler-icon-sunny";
            default:
                return string.Empty;
        }
    }
}

Scheduler - Date Header Template

Run Demo: Scheduler - Date Header Template

Inheritance

Object
SchedulerDateHeaderCellInfo
See Also