Skip to main content

DxScheduler.HtmlCellDecoration Event

Allows you to customize the appearance of Scheduler cells.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Action<SchedulerHtmlCellDecorationEventArgs> HtmlCellDecoration { get; set; }

Event Data

The HtmlCellDecoration event's data class is SchedulerHtmlCellDecorationEventArgs. The following properties provide information specific to this event:

Property Description
CellType Specifies the Scheduler cell’s type.
CssClass Assigns a CSS class to the Scheduler cell.
Intervals Specifies the interval(s) to which the Scheduler cell belongs.
Resources Specifies resources associated with the Scheduler cell.
Style Specifies the name of an HTML style attribute applied to the cell.

Remarks

Handle the HtmlCellDecoration event to customize the appearance of Scheduler cells. In the event handler, use the event argument’s CellType property to identify the processed cell’s type. The following are available:

The event argument’s Intervals property defines the interval(s) to which a cell belongs. The Resources property specifies resources associated with the cell or contains an empty resource item if no resources are assigned.

Use the following properties to customize the cell’s appearance:

  • CssClass - The name of a CSS class applied to the cell.
  • Style - The name of an HTML style attribute applied to the cell.

The following example customizes time cells in the interval between 13 and 14 hours and all date headers:

@using Data

<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             HtmlCellDecoration="OnHtmlCellDecoration">
    <DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = RecurringAppointmentCollection.GetAppointments(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence"
        }
    };
    void OnHtmlCellDecoration(SchedulerHtmlCellDecorationEventArgs args) {
        if (args.CellType == SchedulerCellType.TimeCell && 13 <= args.Intervals.Start.Hour
                          && args.Intervals.Start.Hour < 14)
            args.CssClass = "bg-secondary";
        if (args.CellType == SchedulerCellType.DateHeader)
            args.Style = "background-color: rgb(224, 211, 245);";
    }
}

Blazor Scheduler HTML Cell Decoration

See Also