SchedulerControl.SelectedResource Property
Gets the resource which contains the time interval currently selected in the scheduler's active view by an end-user.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v14.2.dll
#Declaration
#Property Value
Type | Description |
---|---|
Resource | A Resource object which is the selected resource. |
#Remarks
If there is no grouping specified for the scheduler (SchedulerControl.GroupType is equal to None), then the selected resource will be set to Resource.Empty.
#Examples
This example demonstrates how to create a new appointment for the time interval currently selected in a scheduler control. Also, shows how to get a resource that contains the selected time interval and set a resource's Id to the appointment. The selected time interval is accessed via the SchedulerControl.SelectedInterval property and the selected resource is accessed via the SchedulerControl.SelectedResource property. An appointment is added to the SchedulerStorage.AppointmentStorage collection of the scheduler's SchedulerControl.Storage.
using DevExpress.Xpf.Scheduler;
using DevExpress.XtraScheduler;
// ...
// Create a new appointment.
Appointment apt = new Appointment();
// Set the appointment's time interval to the time interval
// currently selected by an end-user.
apt.Start = schedulerControl1.SelectedInterval.Start;
apt.End = schedulerControl1.SelectedInterval.End;
// Set the appointment's resource to the resource, which
// contains the currently selected time interval.
apt.ResourceId = schedulerControl1.SelectedResource.Id;
// Add the new appointment to the appointment collection.
schedulerControl1.Storage.AppointmentStorage.Add(apt);