menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DropEventArgs<T> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DropEventArgs<T>

    Provides event data for the OnDrop and Dropped events in the SfListBox<TValue, TItem> component.

    Inheritance
    System.Object
    DropEventArgs<T>
    Namespace: Syncfusion.Blazor.DropDowns
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DropEventArgs<T> : Object
    Type Parameters
    Name Description
    T

    The type representing the dropped items (typically TItem).

    Remarks

    This argument provides access to event details during listbox item drop, including placement, involved items, and positional data.

    Examples
    private void OnItemDrop(DropEventArgs<Employee> args)
    {
        var target = args.TargetId;
        var left = args.Left;
    }

    Constructors

    DropEventArgs()

    Declaration
    public DropEventArgs()

    Properties

    Cancel

    Gets or sets a value indicating whether the drop event should be canceled.

    Declaration
    public bool Cancel { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the drop event should be canceled; otherwise, false. The default value is false.

    Remarks

    Set to true to prevent completing the drag-and-drop action.

    Examples
    args.Cancel = true;

    DropIndex

    Gets the index of the dropped target within the SfListBox<TValue, TItem>.

    Declaration
    public int DropIndex { get; }
    Property Value
    Type Description
    System.Int32

    An int that is the index position for the drop. The default value is 0.

    Remarks

    Indicates where the dropped item(s) will be inserted in the destination.

    Examples
    int targetIdx = args.DropIndex;

    Items

    Gets or sets the items involved in the drop event.

    Declaration
    public IEnumerable<T> Items { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<T>

    An System.Collections.Generic.IEnumerable<> containing the items being dropped. The default value is null.

    Remarks

    Use to process or modify dropped items in your application logic.

    Examples
    var droppedItems = args.Items;

    Left

    Gets the X coordinate (client left) value of the target element during drop.

    Declaration
    public double Left { get; }
    Property Value
    Type Description
    System.Double

    A double representing the client X value while dropping. Default is 0.

    Remarks

    Use Left and Top to determine drop position, especially when dragging outside the component.

    Examples
    double x = args.Left;

    TargetId

    Gets the ID of the element on which the user releases the mouse or finger to complete a drag-and-drop action.

    Declaration
    public string TargetId { get; }
    Property Value
    Type Description
    System.String

    A string with the ID of the element. Default is null when not dropped over a DOM element with an ID.

    Remarks

    Use for advanced drag-and-drop scenarios involving targets outside the ListBox.

    Examples
    var id = args.TargetId;

    Top

    Gets the Y coordinate (client top) value of the target element during drop.

    Declaration
    public double Top { get; }
    Property Value
    Type Description
    System.Double

    A double representing the client Y value while dropping. Default is 0.

    Remarks

    Use Left and Top for drop calculations outside the component area.

    Examples
    double y = args.Top;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved