menu

Blazor

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

    Show / Hide Table of Contents

    Class DragEventArgs<T>

    Provides event data for the DragStart event of the SfListBox<TValue, TItem> component.

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

    The type of the event data (usually TItem).

    Remarks

    This event is triggered when a drag operation is initiated from a ListBox item.

    Examples
    private void OnDragStart(DragEventArgs<Employee> args)
    {
        if (args.Items != null && args.Items.Count() > 1) {
            // Custom logic for multi-item drag
        }
    }

    Constructors

    DragEventArgs()

    Declaration
    public DragEventArgs()

    Properties

    Cancel

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

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

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

    Remarks

    Set this property to true within your event handler to prevent the default drag operation.

    Examples
    args.Cancel = true; // Cancels drag

    DragIndex

    Gets the index of the dragged item in the source SfListBox<TValue, TItem>.

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

    An int that identifies the index of the last dragged item. The default value is 0.

    Remarks

    If multiple items are selected for dragging, DragIndex is the index of the last item.

    Examples
    int index = args.DragIndex;

    Items

    Gets or sets the items being dragged during the drag operation.

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

    An System.Collections.Generic.IEnumerable<> representing the dragged items. The default value is null.

    Remarks

    Use this property to manipulate or examine the items involved in the drag event.

    Examples
    var draggedItems = args.Items;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved