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

SchedulerControl.SelectedInterval Property

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

Namespace: DevExpress.Xpf.Scheduler

Assembly: DevExpress.Xpf.Scheduler.v20.2.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Scheduler, DevExpress.Wpf.Scheduler

Declaration

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

Property Value

Type Description
TimeInterval

A TimeInterval object representing the selected time interval.

Remarks

Important

You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

Example

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);
See Also