maui-404968-tree-view-node-selection.md
DXTreeView supports single node selection.
To select and deselect nodes, enable AllowSelection and AllowDeselectSingleItem properties.
A user can tap a node to select it. The SelectedItem property then returns the corresponding data source item. A user can tap the selected node again to clear selection. The SelectedItem property then returns null.
<dx:DXTreeView ...
ItemsSource="{Binding Nodes}"
AllowSelection="True"
AllowDeselectSingleItem="True"
SelectedItem="{Binding SelectedNodes}">
...
</dx:DXTreeView>
The DXTreeView ships with the following selection-related events. These events may be triggered from the UI (a user taps a node) or from code (the SelectedItem property value changes):
SelectedItemChangedFires when the selected item is changed.SelectedItemChangingFires when a user attempts to select an item, but before selection changes.
Use SelectedBackgroundColor and SelectedBorderColor properties to change selected node appearance. For more information, refer to the following help topic: Change Selected Node Appearance.