SchedulerViewBase.SetSelection(TimeInterval, Resource) Method

Selects time cells which encompass the specified time interval.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v21.2.dll


public virtual void SetSelection(
    TimeInterval interval,
    Resource resource


Name Type Description
interval TimeInterval

A TimeInterval object that specifies the time interval to select.

resource Resource

A Resource object that specifies to which resource the specified time interval belongs.


Use the SetSelection method to select time cells within the view. The Resource object defined via the resource parameter specifies the resource associated with the selected cells when the view is grouped with the SchedulerViewBase.GroupType set to SchedulerGroupType.Resource or SchedulerGroupType.Date values. For a scheduler without resources, specify the ResourceEmpty.Resource value as the resource parameter.


Calling the SetSelection method raises the SchedulerControl.SelectionChanged event.


This code selects time cells in the range which starts from the current time and lasts for 2 h 40 min. The selection snaps to the nearest time cell boundaries. Only cells in the column which belong to the second visible resource are selected. The SchedulerControl.CustomDrawTimeCell event is handled to highlight the selection with a specific color.

View Example

scheduler.CustomDrawTimeCell += scheduler_CustomDrawTimeCell_2;
scheduler.ActiveView.GroupType = SchedulerGroupType.Resource;
scheduler.ActiveView.SetSelection(new TimeInterval(DateTime.Now, new TimeSpan(2, 40, 0)), scheduler.ActiveView.GetResources()[1]);
See Also