TreeList.SelectionChanging Event
Allows you to specify whether users can select and unselect nodes.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
[DXCategory("Property Changed")]
public event EventHandler<SelectionChangingEventArgs> 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 nodes is about to change. |
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
Node | Gets the processed node. |
Remarks
The SelectionChanging
event is raised in multiple selection mode before a user selects/unselects a node (nodes). This event allows you to cancel the action.
The following code sample does not allow users to select root nodes:
treeList.SelectionChanging += (s, e) => {
e.Cancel = e.Action == CollectionChangeAction.Add && e.Node.Level == 0;
};
See Also