Skip to main content
A newer version of this page is available. .

TreeList.SelectionChanged Event

Fires in response to changing selection when the TreeList is in multiselect mode.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.1.dll

Declaration

[DXCategory("Property Changed")]
public event EventHandler SelectionChanged

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.

Selections - Changed

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;
}
See Also