SchedulerViewBase.SetSelection(TimeInterval, Resource) Method

Selects time cells which encompass the specified time interval.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v20.1.dll

Declaration

public virtual void SetSelection(
    TimeInterval interval,
    Resource resource
)
Public Overridable Sub SetSelection(
    interval As TimeInterval,
    resource As Resource
)

Parameters

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.

Remarks

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.

NOTE

Calling the SetSelection method raises the SchedulerControl.SelectionChanged event.

Examples

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.

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