Skip to main content
All docs
V25.1
  • ColumnView.SelectionChanging Event

    Allows you to specify whether users can select and unselect rows.

    Namespace: DevExpress.XtraGrid.Views.Base

    Assembly: DevExpress.XtraGrid.v25.1.dll

    NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

    Declaration

    [DXCategory("Property Changed")]
    public event SelectionChangingEventHandler SelectionChanging

    Event Data

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

    Property Description
    Action Gets an action that describes how the collection of selected rows is about to change.
    Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
    ControllerRow Gets the processed row handle.

    Remarks

    The SelectionChanging event is raised in multiple selection mode before a user selects/unselects a row (rows). This event allows you to cancel the action.

    The following code sample does not allow users to select the first 5 rows:

    gridView1.SelectionChanging += (s, e) => {
        e.Cancel = e.Action == CollectionChangeAction.Add && e.ControllerRow <= 4;
    };
    
    See Also