Selection
RadPropertyGrid provides you with a selection functionality, which allows the user to select one or more items from the data displayed by the control.
Selection Modes
RadPropertyGrid provides three selection modes, which allow you to manipulate the type of selection. This is controlled by the SelectionMode enumeration property which has the following entries:
Single: Only one item can be selected at a time. (default value)
Multiple: Items are added to the selection when they get clicked and get removed when they get clicked again.
Extended: Items are added to the selection only by combining the mouse clicks with the Ctrl or Shift key.
Example 1: Setting the SelectionMode to Multiple
Example 2: Setting the SelectionMode to Multiple
Pressing Ctrl+A will select all items.
Selected items
RadPropertyGrid provides two properties to get the data behind the selected items - SelectedPropertyDefinition and SelectedPropertyDefinitions.
SelectedPropertyDefinition: The business object that sits behind the selected Property Definition.
SelectedPropertyDefinitions: A collection of the business objects that sits behind the selected Property Definitions. It will contain more than one item when the SelectionMode is either Multiple or Extended.
Example 3: Binding to SelectedPropertyDefinition
Example 4: The viewmodel's SelectedDefinition property
As of R2 2016, the SelectedField property, previously marked as obsolete, has officially been removed.
Events
There is a single event relevant to the selection in RadPropertyGrid - SelectionChanged. As suggested by its name, it occurs when the selected property definition has changed.
Example 5: Adding a handler for the SelectionChanged event
Example 6: SelectionChanged event handler
As of R2 2016, the SelectedFieldChanged event, previously marked as obsolete, has officially been removed.