SchedulerControl.LayoutViewInfoCustomizing Event
Use this event to customize the appearance of certain visual elements before they are painted.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v21.1.dll
NuGet Packages: DevExpress.Win.Design, DevExpress.Win.Scheduler
Declaration
Event Data
The LayoutViewInfoCustomizing event's data class is LayoutViewInfoCustomizingEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cache | |
Kind | Gets the type of a visual element that raises the event. |
ShouldRecalculateLayout | Forces layout recalculation after applying changes specified in the event handler. |
ViewInfo | Provides access to the object which contains the information used to render the layout element. |
Remarks
The LayoutViewInfoCustomizing event allows you to implement conditional styling of visual elements contained in the Scheduler view based on the resource and time interval.
The LayoutViewInfoCustomizing event occurs before painting a visual element of the Scheduler view, such as the time cell, day header, day-of-week header or resource header.
Use the LayoutViewInfoCustomizingEventArgs.Kind property to distinguish between a cell and a header. Subsequently, you can cast the LayoutViewInfoCustomizingEventArgs.ViewInfo object to a proper type and modify it as your needs dictate.
Example
This example handles the SchedulerControl.LayoutViewInfoCustomizing
event to change the color of time cells and header captions. The header’s caption indicates the type of ViewInfo object that is used to visualize the header.
public static void scheduler_LayoutViewInfoCustomizing(object sender, LayoutViewInfoCustomizingEventArgs e) {
string s = e.ViewInfo.GetType().ToString().Substring("DevExpress.XtraScheduler.Drawing.".Length);
if (e.Kind == LayoutElementKind.DateHeader) {
SchedulerHeader header = e.ViewInfo as SchedulerHeader;
if (header != null) header.Caption = s;
}
if (e.Kind == LayoutElementKind.Cell) {
SchedulerViewCellBase cell = e.ViewInfo as SchedulerViewCellBase;
if (cell != null) cell.Appearance.BackColor = Color.LightYellow;
SingleWeekCellBase cellWeek = e.ViewInfo as SingleWeekCellBase;
if (cellWeek != null) {
cellWeek.Appearance.BackColor = Color.LightCyan;
cellWeek.Header.Caption = s;
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LayoutViewInfoCustomizing event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.