Skip to main content

DxSchedulerDayViewBase.TimeCellTemplate Property

Specifies a template used to display time cells in the Scheduler.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment<SchedulerTimeCellInfo> TimeCellTemplate { get; set; }

Property Value

Type Description
RenderFragment<SchedulerTimeCellInfo>

The time cell template.

Remarks

The TimeCellTemplate allows you to customize the content and appearance of time cells in the Scheduler.

This template accepts a SchedulerTimeCellInfo object as the context parameter. You can use the parameter’s Interval property to get the interval to which the time cell belongs. The parameter’s Resource property specifies the resource associated with the time cell or contains an empty resource item if no resource is assigned.

The following example displays placeholder text for time cells that do not contain appointments:

@using Data

<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage">
    <DxSchedulerDayView ShowWorkTimeOnly="true">
        <TimeCellTemplate>
            @{
                var appointments = DataStorage.GetAppointments(context.Interval).ToList();
                if (appointments.Count == 0) {
                    <div style="height: 100%; display: flex; justify-content:center">
                        Nothing planned</div>
                }
            }
        </TimeCellTemplate>
    </DxSchedulerDayView>
</DxScheduler>

@code {
    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"
        }
    };
}

Scheduler Time Cell Template in Day View

See Also