windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-ebc930b3.md
Gets the time interval currently selected in the scheduler’s active view by an end-user.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.dll
NuGet Package : DevExpress.Win.Scheduler
[Browsable(false)]
public TimeInterval SelectedInterval { get; }
<Browsable(False)>
Public ReadOnly Property SelectedInterval As TimeInterval
| Type | Description |
|---|---|
| TimeInterval |
A TimeInterval object representing the selected time interval.
|
This example creates a new appointment for the selected time interval and resource on a button click.
SchedulerControl.SelectedInterval property to get the selected time interval. Assign the interval’s start and end values to Appointment.Start and Appointment.End properties.void simpleButton1_Click(object sender, EventArgs e) {
// Create a new appointment.
Appointment apt = scheduler.DataStorage.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 that contains
// the selected time interval.
apt.ResourceId = scheduler.SelectedResource.Id;
// Add the appointment to the appointment collection.
scheduler.DataStorage.Appointments.Add(apt);
}
' Create a new appointment.
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
' Create a new appointment.
Dim apt As Appointment = scheduler.DataStorage.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 that contains
' the selected time interval.
apt.ResourceId = scheduler.SelectedResource.Id
' Add the appointment to the appointment collection.
scheduler.DataStorage.Appointments.Add(apt)
End Sub
See Also