Selection

RadTreeMap and RadPivotMap support selection functionality which is disabled by default. You can enable it by setting the control's IsSelectionEnabled property to True.

The following examples use RadTreeMap but the same properties are exposed by the RadPivotMap control as well.

<telerik:RadTreeMap IsSelectionEnabled="True"> 

treeMap.IsSelectionEnabled = true; 
treeMap.IsSelectionEnabled = True 

Selection Modes

The selection feature supports several modes which you can set through the SelectionMode property.

  • Single (default value): This mode allows selection of a single item only. Clicking an item will select it and deselect the previously selected one, if there is such.
  • Multiple: This mode allows selection of multiple items. Clicking an item will select it and it will keep the previously selected items.
  • Extended: This mode combines the Single and Multiple modes. Clicking an item deselect the others, however, if the Ctrl key is pressed the previous selection will be preserved.

<telerik:RadTreeMap SelectionMode="Extended" /> 

treeMap.SelectionMode = System.Windows.Controls.SelectionMode.Extended; 
treeMap.SelectionMode = System.Windows.Controls.SelectionMode.Extended 

RadTreeMap and RadPivotMap controls expose several properties which allow you to access the current selected item(s).

  • SelectedItem: Gets the selected item.
  • SelectedItems: Gets a read-only collection that contains the selected items.
  • SelectedValue: Gets or sets a value from the SelectedItem.
  • SelectedValuePath: Gets or sets a path that is used to get the SelectedValue for the SelectedItem.

Events

There are couple events which are fired when the selection is changed - SelectionChanged and PreviewSelectionChanged. Their handlers use an object of type SelectionChangedRoutedEventArgs as a second parameter that holds information about the selection.

See Also

In this article