Skip to main content
All docs
V25.2
  • ListBoxItemClickEventArgs<TData, TValue> Class

    Contains data for the ItemClick event.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    Declaration

    public class ListBoxItemClickEventArgs<TData, TValue>

    Type Parameters

    Name Description
    TData

    The data item type.

    TValue

    The value type.

    Remarks

    Use the ItemClick event to handle List Box item clicks.

    Use the ListBoxItemClickEventArgs event arguments to access information about the clicked item and determine which action triggered the event.

    Note

    By default, the List Box triggers item selection when a user clicks an item or focuses it and presses the Space key. You can handle the ItemClick event to also treat Enter as a selection key.

    The following code determines which action triggers the ItemClick event. If a user presses the Enter key, the List Box selects the corresponding item.

    <DxListBox Data="@Staff.DataSource"
               TData="Person"
               TValue="Person"
               @bind-Value="ListBoxValue"
               ItemClick="@OnItemClick">
        <Columns>
            <DxListEditorColumn FieldName="@nameof(Person.FirstName)" Caption="First Name" />
            <DxListEditorColumn FieldName="@nameof(Person.LastName)" Caption="Last Name" />
            <DxListEditorColumn FieldName="@nameof(Person.Department)" />
        </Columns>
    </DxListBox>
    
    @code {
        Person ListBoxValue;
    
        void OnItemClick(ListBoxItemClickEventArgs<Person, Person> args) {
            if (args.InputDevice == InputDevice.Keyboard) {
                args.ListBox.BeginUpdate();
                args.ListBox.Value = args.DataItem;
                args.ListBox.EndUpdate();
            }
        }
    }
    

    Inheritance

    Object
    ListBoxItemClickEventArgs<TData, TValue>
    See Also