Skip to main content
All docs
V26.1
  • DxSchedulerMonthView.DateHeaderCellTemplate Property

    Specifies the template for date header cells in the Scheduler.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v26.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [Parameter]
    public RenderFragment<SchedulerDateHeaderCellInfo> DateHeaderCellTemplate { get; set; }

    Property Value

    Type Description
    RenderFragment<SchedulerDateHeaderCellInfo>

    The date header cell template.

    Remarks

    This template accepts a SchedulerTimelineHeaderCellInfo object as the context parameter. You can use the parameter’s Interval property to get the interval to which the cell belongs.

    The following code snippet highlights weekends with color:

    <DxScheduler @bind-StartDate="@StartDate" DataStorage="@DataStorage" CssClass="demo-sc-size">
        <Views>
            <DxSchedulerMonthView CellMinWidth="50">
                <DateHeaderCellTemplate>
                    <div class="@GetDateCssClass(context.Interval.Start)">
                        <span class="scheduler-date">@context.Interval.Start.Day</span>
                        <span>@context.Interval.Start.ToString("ddd")</span>
                    </div>
                </DateHeaderCellTemplate>
            </DxSchedulerMonthView>
        </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 GetDateCssClass(DateTime date)
        {
            if(date.DayOfWeek == DayOfWeek.Sunday
                || date.DayOfWeek == DayOfWeek.Saturday) return "scheduler-weekend";
            else return "scheduler-weekday";
        }
    }
    

    Scheduler - Date Header Template

    See Also