Back to Devexpress

NavigationCheckedChangedEventArgs<TInfo>.CheckedItems Property

blazor-devexpress-dot-blazor-dot-base-dot-navigationcheckedchangedeventargs-1-f23662b4.md

latest2.0 KB
Original Source

NavigationCheckedChangedEventArgs<TInfo>.CheckedItems Property

Returns all checked items.

Namespace : DevExpress.Blazor.Base

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public IReadOnlyList<TInfo> CheckedItems { get; }

Property Value

TypeDescription
IReadOnlyList<TInfo>

Checked items.

|

Remarks

TreeView adds nodes to the CheckedItems collection. This collection does not contain nodes with indeterminate state.

The following code snippet handles the CheckedChanged event to respond to user interactions with node checkboxes. The handler obtains the collection of nodes whose state is checked. If the collection is not empty, the code displays the first node’s text.

razor
First checked node: @FirstChecked

<DxTreeView Data="@Data"
            CheckMode="TreeViewCheckMode.Recursive"
            CheckedChanged="CheckedChanged">
    <DataMappings>
        <DxTreeViewDataMapping Text="Name"
                               Key="Id"
                               ParentKey="CategoryId" />
    </DataMappings>
</DxTreeView>

@code {
    string? FirstChecked = "none";
    void CheckedChanged(TreeViewCheckedChangedEventArgs e) {
        var firstCheckedNode = e.CheckedItems.FirstOrDefault();
        FirstChecked = firstCheckedNode != null ? firstCheckedNode.Text : "none";
    }
}

See Also

NavigationCheckedChangedEventArgs<TInfo> Class

NavigationCheckedChangedEventArgs<TInfo> Members

DevExpress.Blazor.Base Namespace