All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

SchedulerControl.CustomDayViewColumnWidth Event

Allows you to set custom relative widths to DayView, WorkWeekView and FullWeekView columns.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v21.1.dll

Declaration

public event CustomDayViewColumnWidthEventHandler CustomDayViewColumnWidth

Event Data

The CustomDayViewColumnWidth event's data class is DevExpress.XtraScheduler.CustomDayViewColumnWidthEventArgs.

Remarks

Event arguments provide access to a list of DayViewColumnLayoutInfo objects. Each object is associated with one of the visible columns, and allows you to retrieve or set up the following information:

  • DayViewColumnLayoutInfo.Interval - allows you to identify a column’s date.
  • DayViewColumnLayoutInfo.Resource - returns a Scheduler Resource that owns this column.
  • DayViewColumnLayoutInfo.ResourceCategory - returns a resource category that owns the column’s parent resource.
  • DayViewColumnLayoutInfo.RelativeWidth - set this integer value to specify the column width in relative units. If the DayView.ColumnWidthMode property equals Auto, this property returns the automatically calculated column width. In Fixed mode, all columns are of the same width and RelativeWidth always returns “1”.

Example 1

The following sample illustrates how to make week day columns three times as wide as weekend columns.

Custom column widhts in Scheduler

void OnCustomDayViewColumnWidth(object sender, CustomDayViewColumnWidthEventArgs e) {
    foreach (var info in e.DayViewColumnLayoutInfos) {
        if (info.Interval.Start.DayOfWeek == DayOfWeek.Saturday || 
            info.Interval.Start.DayOfWeek == DayOfWeek.Sunday)
            info.RelativeWidth = 1;
        else
            info.RelativeWidth = 3;
    }
}

Example 2

If the DayView.ColumnWidthMode property equals Auto, columns resize proportionally to their content. The more appointments are scheduled for the same time slot, the wider their parent column is. The code below illustrates how to limit the maximum column width by 3 relative units.

void OnCustomDayViewColumnWidth(object sender, CustomDayViewColumnWidthEventArgs e) {
    foreach (var info in e.DayViewColumnLayoutInfos)
        if (info.RelativeWidth > 3) info.RelativeWidth = 3;
}
See Also