Skip to main content

SchedulerControl.SelectedInterval Property

Gets the time interval currently selected in the scheduler’s active view by an end-user.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.2.dll

Declaration

[Browsable(false)]
public TimeInterval SelectedInterval { get; }

Property Value

Type Description
TimeInterval

A TimeInterval object representing the selected time interval.

Example

This example demonstrates how to create a new appointment for the time interval currently selected in the scheduler. 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.Appointments collection of the scheduler’s SchedulerControl.Storage.

// Delete all appointments.
scheduler.Storage.Appointments.Clear();
// Select time interval
scheduler.ActiveView.SetSelection(new TimeInterval(DateTime.Now, new TimeSpan(2, 40, 0)), scheduler.ActiveView.GetResources()[1]);
// Group by resource.
scheduler.GroupType = SchedulerGroupType.Resource;
// Create a new appointment.
Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Normal);

// Set the appointment's time interval to the selected time interval.
apt.Start = scheduler.SelectedInterval.Start;
apt.End = scheduler.SelectedInterval.End;

// Set the appointment's resource to the resource which contains
// the currently selected time interval.
apt.ResourceId = scheduler.SelectedResource.Id;

// Add the new appointment to the appointment collection.
scheduler.Storage.Appointments.Add(apt);
See Also