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

Selecting

  • 3 minutes to read

The SchedulerControl allows you to access the appointments, time cells or resources an end-user selected.

Select and Deselect Appointments

The SchedulerControl.SelectedAppointments property provides access to the selected appointments collection. To select an appointment, add it to the collection, to deselect - remove it from the collection.

Obtain Selected Appointments

Use the SchedulerControl.SelectedAppointments property to retrieve the selected appointments collection.

Note

The complete sample project How to obtain the appointment, resource or time interval selected by an end-user is available in the DevExpress Examples repository.

<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto">
    <ItemsControl ItemsSource="{DXBinding '@e(schedulerControl).SelectedAppointments'}">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <TextBox Background="Beige" Text="{Binding Subject}" />
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>

Obtain Selected Time Interval and Resource

Use the SchedulerControl.SelectedInterval property to retrieve the time cells interval selected by an end-user. When selecting an appointment, this property returns the interval this appointment occupies.

The SchedulerControl.SelectedResource property provides access to the resource related to the selected time interval.

You can change the selected time interval by moving the selection in the desired direction. Call the corresponding view‘s MoveSelection method to complete the task.

To determine the selection change, subscribe to the SchedulerControlBase.DependencyPropertyChanged event, as illustrated in the following code snippet.

Note

The complete sample project How to obtain the appointment, resource or time interval selected by an end-user is available in the DevExpress Examples repository.

private void schedulerControl_DependencyPropertyChanged(object sender, DependencyPropertyChangedEventArgs e)
{
    SchedulerControl scheduler = sender as SchedulerControl;
    if (e.Property == SchedulerControl.SelectedIntervalProperty)
    {
        OutputBox.AppendText(string.Format("SelectedInterval is changed. New value is {0} \r\n", e.NewValue));
        OutputBox.ScrollToEnd();
    }
    if (e.Property == SchedulerControl.SelectedResourceProperty)
    {
        OutputBox.AppendText(string.Format("SelectedResource is changed. New value is {0} \r\n", ((ResourceItem)e.NewValue).Caption));
        OutputBox.ScrollToEnd();
    }
}

Bind Selection to the Source

Use the following properties to bind the selected appointments and resources to the source objects in MVVM architecture:

Selection in the User Interface

End-users can select a particular date, specific appointment, a date or time cell range, and a range of appointments. The table below lists all available actions:

Action Effect
Click any date in the Scheduler (if the currently active view is set to either the Week View or Month View) Selects a day
Click and drag across the time cells (in the Week View or Month View only). Selects a continuous date range. Does not change the selected range in the DateNavigator control (if it is provided).
Clicking the mouse Selects a time cell
Clicking and dragging the mouse Selects a continuous time cell range
Pressing the SHIFT+ARROW KEY combination. Allows end-users to select a continuous time cell range. Note that this clears a previous cell selection
Click any appointment in the Scheduler Selects an appointment
Click appointments while pressing the SHIFT or CTRL key Selects multiple appointments

Tip

Use the SchedulerControl.AllowAppointmentMultiSelect property to restrict selecting multiple appointments.