Back to Devexpress

CustomizeElementStyleEventArgs Class

aspnet-devexpress-dot-web-dot-aspxscheduler-90881b57.md

latest4.3 KB
Original Source

CustomizeElementStyleEventArgs Class

Provides data for the ASPxScheduler.CustomizeElementStyle event.

Namespace : DevExpress.Web.ASPxScheduler

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

NuGet Package : DevExpress.Web.Scheduler

Declaration

csharp
public class CustomizeElementStyleEventArgs :
    EventArgs
vb
Public Class CustomizeElementStyleEventArgs
    Inherits EventArgs

CustomizeElementStyleEventArgs is the data class for the following events:

Remarks

Use the ASPxScheduler.CustomizeElementStyle event to customize the visual representation of scheduler control elements, such as day headers, horizontal and vertical resource headers, all-day area, time cells, etc. The CustomizeElementStyleEventArgs provides the CustomizeElementStyleEventArgs.Style property that allows you to set different style attributes for the visual element, the CustomizeElementStyleEventArgs.ElementType property specifying the element type, the CustomizeElementStyleEventArgs.Cell property obtaining information on a resource and time interval corresponding to the visual element, and the CustomizeElementStyleEventArgs.IsAlternate property determining whether the visual element is highlighted within the scheduler control.

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.

csharp
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;
    }
}
vb
Imports DevExpress.Web.ASPxScheduler
' ...

Protected Sub ASPxScheduler1_CustomizeElementStyle(ByVal sender As Object, _
                                                   ByVal e As CustomizeElementStyleEventArgs)
    If e.ElementType = WebElementType.VerticalResourceHeader Then
        Dim id As Integer = ASPxScheduler1.Storage.Resources.Items.IndexOf(e.Cell.Resource)
        e.Style.BackColor = ASPxScheduler1.ResourceColorSchemas(id Mod ASPxScheduler1.ResourceColorSchemas.Count).Cell
    End If
End Sub

Inheritance

Object EventArgs CustomizeElementStyleEventArgs

See Also

CustomizeElementStyleEventArgs Members

DevExpress.Web.ASPxScheduler Namespace