Event SelectionChanged
Occurs when the SelectedItem property or the SelectedItems collection has changed.
public event EventHandler? SelectionChanged
Returns
- EventHandler
- Occurs when the property or the collection has changed.
Remarks
You can create an event handler for this event to determine when the selected item in the TreeView has been changed. This can be useful when you need to display information in other controls based on the current selection in the TreeView.
If the SelectionMode property is set to Multiple, any change to the SelectedItems collection, including removing an item from the selection, will raise this event.
The SelectedItems collection changes whenever an individual TreeViewItem selection changes. The property change can occur programmatically or when the user selects an item or clears the selection of an item.