Multiple Selection

The RadGridView allows the user to select more than one item from the displayed data. By default this functionality is disabled and to turn it on you have to set the SelectionMode property to either Multiple or Extended.

XAML

<telerik:RadGridView x:Name="radGridView"
                     SelectionMode="Extended">
    ...
</telerik:RadGridView>

C#

this.radGridView.SelectionMode = System.Windows.Controls.SelectionMode.Extended;

VB.NET

Me.radGridView.SelectionMode = System.Windows.Controls.SelectionMode.Extended

Users will be able to select multiple records using the common key modifiers - Shift and Ctrl. Hold Shift to select a range of grid rows - click on the first one and holding the Shift key, click on the last row in the range. RadGridView will select all rows between those two. You can select a set of grid rows (not necessarily neighboring). Hold the Ctrl key and click on the rows which you want to be selected. The same rules apply to the cells if the SelectionUnit property is set to Cell.

Pressing Ctrl+A will select all items.

The Multiple value of the SelectionMode enumerator allows the user to add an item to the selection just by clicking on it. It will be removed when it gets clicked again.

You can access all selected rows (or data items) through the SelectedItems collection and all the selected cells through the SelectedCells collection. The following example demonstrates how to bind a ListBox to the selected items of a grid:

XAML

<ListBox x:Name="listBoxSelectedItems"
         DisplayMemberPath="Name"
         ItemsSource="{Binding SelectedItems, ElementName=radGridView}" />

C#

listBoxSelectedItems.ItemsSource = this.radGridView.SelectedItems;

VB.NET

listBoxSelectedItems.ItemsSource = Me.radGridView.SelectedItems

When multiple items are selected the SelectedItem property has as value the first selected one.

See Also