Skip to main content
A newer version of this page is available. .

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.v19.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);

The following code snippets (auto-collected from DevExpress Examples) contain references to the SelectedInterval property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also