Class ListBoxKeyDownEventArgs
Provides event data for the ListBoxItemKeyDown event, which handles keyboard interactions in the SfListBox<TValue, TItem> component.
Inheritance
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class ListBoxKeyDownEventArgs : Object
Remarks
Use this event to prevent or customize the response to key presses within the ListBox.
Examples
private void OnKeyDown(ListBoxKeyDownEventArgs args)
{
if (args.Event != null && args.Event.Key == "Delete") {
args.PreventDefaultAction = true;
}
}
Constructors
ListBoxKeyDownEventArgs()
Declaration
public ListBoxKeyDownEventArgs()
Properties
Event
Gets or sets the underlying Microsoft.AspNetCore.Components.Web.KeyboardEventArgs associated with the key press.
Declaration
public KeyboardEventArgs Event { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.Web.KeyboardEventArgs | An instance of Microsoft.AspNetCore.Components.Web.KeyboardEventArgs containing information about the keyboard event. |
Remarks
Use this property to determine which key was pressed and access key-related metadata for advanced behaviors.
Examples
var key = args.Event?.Key;
PreventDefaultAction
Gets or sets a value that determines whether to allow or prevent the default keyboard action in the ListBox.
Declaration
public bool PreventDefaultAction { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Set this property to true
in your event handler to block standard keyboard behavior (such as deleting or moving items).
Examples
args.PreventDefaultAction = true;