alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class ListBoxEvents<TValue, TItem>

    Declares the set of event callbacks exposed by SfListBox<TValue, TItem> for handling filtering, selection, drag-and-drop, creation, and more.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    ListBoxEvents<TValue, TItem>
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ListBoxEvents<TValue, TItem> : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Type Parameters
    Name Description
    TValue

    The type used to represent selected item values (e.g., string[] or int).

    TItem

    The data type for items displayed in the ListBox (e.g., an entity or simple value).

    Remarks

    Use these events to customize data requests, selection logic, UI feedback, and integration scenarios for SfListBox<TValue, TItem>.

    Examples

    This example demonstrates how to listen for creation, value changes, and filtering events in a ListBox:

    <SfListBox @ref="ListBoxObj" DataSource="@vehicleData" TValue="string[]" TItem="ListItem">
        <ListBoxFieldSettings Text="Text" Value="ID"></ListBoxFieldSettings>
        <ListBoxEvents TValue="string[]" Created="OnCreated" ValueChange="OnValueChange" Filtering="OnFiltering"></ListBoxEvents>
    </SfListBox>
    @code {
        SfListBox<string[], ListItem> ListBoxObj;
        public List<ListItem> vehicleData = new List<ListItem> {
            new ListItem { Text = "Hennessey Venom", ID = "List-01" },
            new ListItem { Text = "Bugatti Chiron", ID = "List-02" },
            new ListItem { Text = "Bugatti Veyron Super Sport", ID = "List-03" }
        };
        private Task OnCreated(object args) => ListBoxObj.SelectItemsAsync(Value, true);
        private void OnValueChange(ListBoxChangeEventArgs<string[], ListItem> args) { /* React to selection changes */ }
        private void OnFiltering(FilteringEventArgs args) { /* Custom filtering logic */ }
        public class ListItem { public string Text {get;set;} public string ID {get;set;} }
    }

    Constructors

    ListBoxEvents()

    Declaration
    public ListBoxEvents()

    Properties

    Created

    Raised when the ListBox is fully initialized and ready for interaction.

    Declaration
    [Parameter]
    public EventCallback<object> Created { get; set; }
    Property Value
    Type
    EventCallback<object>
    Examples
    private Task OnCreated(object args) { /* Additional setup after creation */ }

    Destroyed

    Raised when the ListBox is destroyed, letting you clean up state or subscriptions.

    Declaration
    [Parameter]
    public EventCallback<object> Destroyed { get; set; }
    Property Value
    Type
    EventCallback<object>

    DragStart

    Triggered before starting to drag an item, enabling custom logic or cancellation.

    Declaration
    [Parameter]
    public EventCallback<DragEventArgs<TItem>> DragStart { get; set; }
    Property Value
    Type
    EventCallback<DragEventArgs<TItem>>
    Remarks

    Available only when AllowDragAndDrop is true.

    Dropped

    Triggered after successful drop operation to let you respond to or process item movement.

    Declaration
    [Parameter]
    public EventCallback<DropEventArgs<TItem>> Dropped { get; set; }
    Property Value
    Type
    EventCallback<DropEventArgs<TItem>>
    Remarks

    Available only when AllowDragAndDrop is true.

    Filtering

    Raised whenever the user enters text to filter or search ListBox items.

    Declaration
    [Parameter]
    public EventCallback<FilteringEventArgs> Filtering { get; set; }
    Property Value
    Type
    EventCallback<FilteringEventArgs>
    Remarks

    Available only when AllowFiltering is true.

    Examples
    private void OnFiltering(FilteringEventArgs args) {
        // Customize query for dynamic filtering
    }

    ListBoxItemKeyDown

    Triggered when performing a keydown action in a ListBox item (e.g. for advanced keyboard handling).

    Declaration
    [Parameter]
    public EventCallback<ListBoxKeyDownEventArgs> ListBoxItemKeyDown { get; set; }
    Property Value
    Type
    EventCallback<ListBoxKeyDownEventArgs>

    OnActionBegin

    Invoked before fetching data from a remote server in the SfListBox<TValue, TItem>. Allows you to customize request parameters or cancel the request.

    Declaration
    [Parameter]
    public EventCallback<ActionBeginEventArgs> OnActionBegin { get; set; }
    Property Value
    Type
    EventCallback<ActionBeginEventArgs>

    OnActionComplete

    Invoked after data has been successfully fetched from a remote server.

    Declaration
    [Parameter]
    public EventCallback<ActionCompleteEventArgs<TItem>> OnActionComplete { get; set; }
    Property Value
    Type
    EventCallback<ActionCompleteEventArgs<TItem>>

    OnActionFailure

    Triggered when a data fetch from the server fails. Use to log or display errors.

    Declaration
    [Parameter]
    public EventCallback<object> OnActionFailure { get; set; }
    Property Value
    Type
    EventCallback<object>

    OnDrop

    Triggered before dropping items onto the ListBox, allowing cancellation or custom drop behavior.

    Declaration
    [Parameter]
    public EventCallback<DropEventArgs<TItem>> OnDrop { get; set; }
    Property Value
    Type
    EventCallback<DropEventArgs<TItem>>
    Remarks

    Available only when AllowDragAndDrop is true.

    OnItemRender

    Occurs before rendering each item in the ListBox, giving you the chance to customize item content or appearance.

    Declaration
    [Parameter]
    public EventCallback<BeforeItemRenderEventArgs<TItem>> OnItemRender { get; set; }
    Property Value
    Type
    EventCallback<BeforeItemRenderEventArgs<TItem>>

    ValueChange

    Triggered when the selected value(s) of the ListBox change.

    Declaration
    [Parameter]
    public EventCallback<ListBoxChangeEventArgs<TValue, TItem>> ValueChange { get; set; }
    Property Value
    Type
    EventCallback<ListBoxChangeEventArgs<TValue, TItem>>

    Methods

    Dispose(bool)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    OwningComponentBase.Dispose(bool)

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    Task
    Overrides
    ComponentBase.OnInitializedAsync()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved