New to Telerik UI for WPF? Download free 30-day trial

Selection in RadTileList

As of Q1 2016, RadTileList exposes a SelectionMode property allowing you to control whether the user can select more than one item in the tile list.

This article covers the following topics:

Selection Mode

The SelectionMode property of RadTileList controls whether users can select one or multiple items and how selecting multiple items can be achieved. The enumeration exposes the following values:

  • Single: The user can select only one item at a time.
  • Multiple: The user can select multiple items without holding down a modifier key.
  • Extended: The user can select multiple consecutive items while holding down the SHIFT key or multiple non-consecutive items by holding down the CTRL key.

Example 1 demonstrates how you can set the SelectionMode property in XAML.

Example 1: Set SelectionMode of RadTileList to Multiple

<telerik:RadTileList x:Name="RadTileList" SelectionMode="Multiple"/> 
Figure 1 shows the result when Multiple selection is enabled and several tiles are included in the selection.

Figure 1: Multiple selection in RadTileList

Grouping SL

SelectedItem and SelectedItems

RadTileList exposes the SelectedItem and SelectedItems properties in order to grant you access to the selected item in the items of the control.

The SelectedItem property corresponds to the item the user has clicked or tapped when SelectionMode is Single.

SelectedItems is a collection of items containing all selected items in the control when SelectionMode is set to Multiple or Extended.

The SelectedItems collection will remain empty when SelectionMode is set to Single and you change the selected item. However, when in Multiple or Extended selection mode, SelectedItem will be set to the last item added to the selected items that is still included in the selection.

Reacting to changes in the selection

Regardless of the mode the selection is in, the SelectionChanged event will be raised when the user changes the selected item or items in RadTileList. The event arguments are of SelectionChangedEventArgs type, so you gain access to the items removed or added to the selection.

The snippet in Example 2 demonstrates how you can react to a change in the current selection.

Example 2: SelectionChanged event handler for RadTileList

private void EmployeesTileList_SelectionChanged(object sender, SelectionChangedEventArgs e) 
{ 
    if (e.RemovedItems.Count == 0) 
    { 
        MessageBox.Show("Please choose an employee"); 
    } 
} 
Private Sub EmployeesTileList_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) 
    If e.RemovedItems.Count = 0 Then 
        MessageBox.Show("Please choose an employee") 
    End If 
End Sub 

See Also

In this article