Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeListRowClickEventArgs Class

Contains data for RowClick and RowDoubleClick events.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public class TreeListRowClickEventArgs :
    GridRowClickEventArgsBase

#Remarks

Handle RowClick and RowDoubleClick events to respond to row clicks. Use TreeListRowClickEventArgs event arguments (Column, VisibleIndex, and so on) to access a clicked row and other TreeList data.

The following example expands/collapses a row once a user double-clicks the row or focuses it and presses Enter:

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData"
            KeyFieldName="Id"
            ParentKeyFieldName="ParentId"
            RowClick="OnRowClick"
            RowDoubleClick="OnRowDoubleClick">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
    void OnRowDoubleClick(TreeListRowClickEventArgs e) {
        if (e.TreeList.IsRowExpanded(e.VisibleIndex))
            e.TreeList.CollapseRow(e.VisibleIndex);
        else
            e.TreeList.ExpandRow(e.VisibleIndex);
    }
    void OnRowClick(TreeListRowClickEventArgs e) {
        if (e.InputDevice == InputDevice.Keyboard)
            if (e.TreeList.IsRowExpanded(e.VisibleIndex))
                e.TreeList.CollapseRow(e.VisibleIndex);
            else
                e.TreeList.ExpandRow(e.VisibleIndex);
    }
}

Enable the AllowSelectRowByClick property to allow users to select and deselect rows by mouse clicks, tap gestures, and keyboard shortcuts. To select a range of rows, users should hold down the Shift key and click the first and last rows in the range. To add/remove a row to/from selection, users should hold down the Ctrl key and click the row.

Razor
<DxTreeList Data="TreeListData"
            KeyFieldName="Id"
            ParentKeyFieldName="ParentId"
            RowClick="OnRowClick"
            AllowSelectRowByClick="true">
    @*...*@
</DxTreeList>

You can use TreeListRowClickEventArgs.ShiftKey and TreeListRowClickEventArgs.CtrlKey event arguments to define whether the Shift or Ctrl key was pressed when a user clicked rows.

#Inheritance

Object
DevExpress.Blazor.Internal.GridEventArgsBase
DevExpress.Blazor.Internal.GridRowClickEventArgsBase
TreeListRowClickEventArgs
See Also