TreeList.SelectionChanged Event
Fires in response to changing selection when the TreeList is in multiselect mode.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v18.2.dll
Declaration
Event Data
The SelectionChanged event's data class is EventArgs.
Remarks
The TreeListOptionsSelection.MultiSelect option enables you to switch the TreeList control to multiselect mode. If this option is enabled, the TreeList allows you to select multiple nodes. The SelectionChanged event fires each time a node is selected or deselected in such a case.
Write a SelectionChanged event handler to perform specific actions each time a node is either selected or deselected. this can be useful if you want to maintain an up-to-date list of selected nodes, for instance.
If the multiselect feature is disabled, use the TreeList.FocusedNodeChanged event to respond to changes in the selected node.
Example
The following sample code displays the number of currently selected nodes in a status bar. The TreeList.SelectionChanged
event is used to respond to changing the selection.
using DevExpress.XtraTreeList;
private void treeList1_SelectionChanged(object sender, EventArgs e) {
string s = (sender as TreeList).Selection.Count.ToString() + " node(s) selected";
barStaticItem1.Caption = s;
}