Skip to main content
All docs
V24.1

TreeListRowClickEventArgs Class

Contains data for RowClick and RowDoubleClick events.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

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.

<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