The SelectedResource property is set to an empty resource (i.e., the resource ID is equal to DevExpress.XtraScheduler.EmptyResourceId.Id value) if the Scheduler's GroupType property is set to None.
Use the 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.
C# |
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();
}
}
|
VB |
Private Sub schedulerControl_DependencyPropertyChanged(ByVal sender As Object, ByVal e As DependencyPropertyChangedEventArgs)
Dim scheduler As SchedulerControl = TryCast(sender, SchedulerControl)
If e.Property = SchedulerControl.SelectedIntervalProperty Then
OutputBox.AppendText(String.Format("SelectedInterval is changed. New value is {0} " & ControlChars.CrLf, e.NewValue))
OutputBox.ScrollToEnd()
End If
If e.Property = SchedulerControl.SelectedResourceProperty Then
OutputBox.AppendText(String.Format("SelectedResource is changed. New value is {0} " & ControlChars.CrLf, CType(e.NewValue, ResourceItem).Caption))
OutputBox.ScrollToEnd()
End If
End Sub
|