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.InputDevice Property

Returns the input device that triggered the event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
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