Skip to main content
All docs
V24.1

TreeListRowClickEventArgs.InputDevice Property

Returns the input device that triggered the event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public InputDevice InputDevice { get; }

Property Value

Type Description
InputDevice

The input device that triggered the event.

Available values:

Name Description
Pointer

A pointing device.

Keyboard

A keyboard.

Remarks

The TreeList component raises the RowClick event in response to the following actions:

  • A user clicks a row with a pointing device.
  • A user focuses a data cell in display mode and presses Enter.

Use the InputDevice event argument to determine which action triggered the RowClick event. For the RowDoubleClick event, the InputDevice property always returns Pointer.

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);
    }
}
See Also