ColumnView.SelectionChanged Event

Fires when row/cell selection is changed in multiple selection mode.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[DXCategory("Property Changed")]
public event SelectionChangedEventHandler SelectionChanged
<DXCategory("Property Changed")>
Public Event SelectionChanged As SelectionChangedEventHandler

Event Data

The SelectionChanged event's data class is SelectionChangedEventArgs. The following properties provide information specific to this event:

Property Description
Action Gets an action which describes how the collection has been changed.
ControllerRow Identifies the row whose selected state has been changed.

Remarks

If the ColumnViewOptionsSelection.MultiSelect property is set to true, it's possible to select multiple rows or cells simultaneously. In this mode, modifying row/cell selection fires the SelectionChanged event. If a specific row/cell is selected, the SelectionChanged event will also fire every time the grid's data is grouped and/or filtered.

Do not rely your business logic on the Action parameter, as its meaning may be changed in the future. Currently, when rows are selected, the SelectionChanged event fires with the Action parameter set to Add or Refresh (depending on how rows are selected). When rows are deselected, the Action parameter will be either Remove or Refresh (depending on how rows are deselected).

The SelectionChangedEventArgs.ControllerRow property may return the GridControl.InvalidRowHandle property's value when a single row is selected. It also returns this value after the selected row collection has been refreshed. For instance, this happens after the data has been grouped or filtered, or after a batch selection modification (see BaseView.BeginSelection).

To obtain currently selected rows and cells, use the ColumnView.GetSelectedRows and GridView.GetSelectedCells methods.

For information on selecting rows/cells in code, see Multiple Row and Cell Selection.

For information on selecting rows/cells at runtime by end-users, refer to End-User Capabilities: Selecting Rows/Cards.

If the ColumnViewOptionsSelection.MultiSelect property is set to false, the multiple row selection feature is disabled. In this mode, the SelectionChanged event doesn't fire when focus moves between rows. To respond to focus moving from one row or card to another (even when multiple selection mode isn't used), you can handle the ColumnView.FocusedRowChanged event.

NOTE

Rows cannot be selected if merging neighboring cells with identical values is allowed (the GridOptionsView.AllowCellMerge option is enabled).

See Also