Skip to main content

Node Selection in Tree View for .NET MAUI

DXTreeView supports single node selection.

DevExpress Tree View for .NET MAUI - 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>

Respond to Selection Changes

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):

SelectedItemChanged
Fires when the selected item is changed.
SelectedItemChanging
Fires when a user attempts to select an item, but before selection changes.

Change Selected Node Appearance

Use SelectedBackgroundColor and SelectedBorderColor properties to change selected node appearance. For more information, refer to the following help topic: Change Selected Node Appearance.