Skip to main content

ASPxScheduler.CustomizeElementStyle Event

Fires before a scheduler’s visual element is rendered.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v24.2.dll

Declaration

public event CustomizeElementStyleEventHandler CustomizeElementStyle

Event Data

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

Property Description
Cell Gets an object providing access to a resource and time interval corresponding to a visual element.
ElementType Gets a type of the scheduler’s visual element.
IsAlternate Gets a value that indicates whether an element is highlighted within the scheduler control.
Style Get the style that defines the appearance of a visual element within the scheduler control.

Remarks

Use CustomizeElementStyle to customize the appearance of the scheduler control’s visual elements. For example, you can specify an element’s foreground, background and border colors, the font settings, etc. To do this, use properties of the style object accessed via CustomizeElementStyleEventArgs.Style. To obtain the element type (date header, vertical or horizontal resource header, all-day area, selection bar, date cell body or date cell header, etc.), use the CustomizeElementStyleEventArgs.ElementType property. The CustomizeElementStyleEventArgs.Cell property provides access to the object containing information on the resource and time interval corresponding to the visual element.

Note

Subscribing to the CustomizeElementStyle event automatically disables client-side rendering of view elements.

For Bootstrap Scheduler Only

The CustomizeElementStyle event is not supported in BootstrapScheduler control.

Limitation

  • The CustomizeElementStyle event does not work in the Agenda view.

Example

This example demonstrates how to fill all resource headers with specific colors obtained from the ASPxScheduler.ResourceColorSchemas collection by handling the ASPxScheduler.CustomizeElementStyle event.

using DevExpress.Web.ASPxScheduler;
// ...

protected void ASPxScheduler1_CustomizeElementStyle(object sender, CustomizeElementStyleEventArgs e) {
    if (e.ElementType == WebElementType.VerticalResourceHeader) {
        int id = ASPxScheduler1.Storage.Resources.Items.IndexOf(e.Cell.Resource);
        e.Style.BackColor = ASPxScheduler1.ResourceColorSchemas[id % ASPxScheduler1.ResourceColorSchemas.Count].Cell;
    }
}
See Also