SchedulerControl.SelectedResource Property
Gets or sets the resource related to the currently selected in the SchedulerControl. This is an dependency property.
Namespace: DevExpress.Xpf.Scheduling
Assembly: DevExpress.Xpf.Scheduling.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
ResourceItem | A ResourceItem object which is the selected resource. |
Remarks
The SelectedResource property is set to an empty resource (i.e., the resource ID is equal to EmptyResourceId.Id value) if the Scheduler’s SchedulerControl.GroupType property is set to None.
Use the SchedulerControl.SelectedResourceSource property to bind the selected resources to a source object.
To determine the selection change, subscribe to the SchedulerControlBase.DependencyPropertyChanged event, as illustrated in the following code snippet.
Note
The complete sample project How to obtain the appointment, resource or time interval selected by an end-user is available in the DevExpress Examples repository.
private void schedulerControl_DependencyPropertyChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SchedulerControl scheduler = sender as SchedulerControl;
if (e.Property == SchedulerControl.SelectedIntervalProperty)
{
OutputBox.AppendText(string.Format("SelectedInterval is changed. New value is {0} \r\n", e.NewValue));
OutputBox.ScrollToEnd();
}
if (e.Property == SchedulerControl.SelectedResourceProperty)
{
OutputBox.AppendText(string.Format("SelectedResource is changed. New value is {0} \r\n", ((ResourceItem)e.NewValue).Caption));
OutputBox.ScrollToEnd();
}
}