Blazorise Drag & Drop API
Explore the Blazorise Drag & Drop API reference for parameters, events, methods, and related types.
For examples and usage guidance, see the Drag & Drop documentation.
API
Parameters
DropContainer
| Parameter | Default | Type |
|---|---|---|
ApplyDropClassesOnDragStarted | false | bool |
When true, DropAllowedClass or DropNotAllowedClass drop classes are applied as soon as a transaction has started. | ||
ChildContent | null | RenderFragment |
Specifies the content to be rendered inside this DropContainer. | ||
DisabledClass | — | string |
Classname that is applied to the dropzone if the result of ItemDisabled is false. | ||
DraggingClass | — | string |
Classname that is applied to the dropzone when the drag operation has started. | ||
DropAllowedClass | — | string |
Classname that is applied if dropping to the current zone is allowed. | ||
DropNotAllowedClass | — | string |
Classname that is applied if dropping to the current zone is not allowed. | ||
ItemDraggingClass | — | string |
Classname that is applied to the drag item when it is being dragged. | ||
Items | null | IEnumerable<TItem> |
Items that are used for the drag&drop withing the container. | ||
ItemTemplate | null | RenderFragment<TItem> |
The render method that is used to render the items withing the dropzone. | ||
PlaceholderTemplate | null | RenderFragment<TItem> |
The template used to render the placeholder for the item being reordered. The template receives the item currently being dragged. | ||
DropZone
| Parameter | Default | Type |
|---|---|---|
AllowReorder | false | bool |
If true, the reordering of the items will be enabled. | ||
Animated | false | bool |
If true, animates item movement during reordering. Requires AllowReorder. Respects the user's reduced motion preference. | ||
AnimationDuration | 200 | int |
Gets or sets the reorder animation duration, in milliseconds. Values less than or equal to zero disable the animation. | ||
ApplyDropClassesOnDragStarted | false | bool? |
When true, DropAllowedClass or DropNotAllowedClass drop classes are applied as soon as a transaction has started. When omitted, inherits the parent container's setting. | ||
ChildContent | null | RenderFragment |
Specifies the content to be rendered inside this DropZone. | ||
DisabledClass | DropContainer.DisabledClass | string |
Classname that is applied to the dropzone if the result of ItemDisabled is false. | ||
DraggingClass | DropContainer.DraggingClass | string |
Classname that is applied to the dropzone when the drag operation has started. | ||
DropAllowedClass | b-drop-zone-drop-allowed | string |
Classname that is applied if dropping to the current zone is allowed. When omitted, inherits the parent container's class before using the built-in class. | ||
DropNotAllowedClass | b-drop-zone-drop-not-allowed | string |
Classname that is applied if dropping to the current zone is not allowed. When omitted, inherits the parent container's class before using the built-in class. | ||
ItemDraggingClass | DropContainer.ItemDraggingClass | string |
Classname that is applied to the drag item when it is being dragged. | ||
ItemTemplate | null | RenderFragment<TItem> |
The render method that is used to render the items withing the dropzone. | ||
Name | — | string |
Specifies the unique name of the dropzone. | ||
OnlyZone | false | bool |
If true, will only act as a dropable zone and not render any items. | ||
PlaceholderTemplate | DropContainer.PlaceholderTemplate | RenderFragment<TItem> |
The template used to render the placeholder for the item being reordered. The template receives the item currently being dragged and overrides the template defined by the parent container. | ||
ShowPlaceholder | true | bool? |
Controls the visibility of the reorder placeholder's outline and content without removing its reserved space. When null, the placeholder is visible for non-animated reordering or when a placeholder template is supplied. When omitted, shows the placeholder if reorder animation is disabled or a placeholder template is available. | ||
Events
DropContainer
| Event | Type |
|---|---|
DropAllowed | Func<TItem, string, bool> |
Determines if the item is allowed to be dropped to the specified zone. | |
ItemDisabled | Func<TItem, bool> |
Determines if the item is disabled for dragging and dropping. | |
ItemDropped | EventCallback<DraggableDroppedEventArgs<TItem>> |
Callback that indicates that an item has been dropped on a drop zone. Should be used to update the "status" of the data item. | |
ItemsFilter | Func<TItem, string, bool> |
The method used to determine if the item belongs to the dropzone. | |
DropZone
| Event | Type |
|---|---|
DropAllowed | Func<TItem, bool> |
Determines if the item is allowed to be dropped to this zone. | |
ItemDisabled | Func<TItem, bool> |
Determines if the item is disabled for dragging and dropping. | |
ItemsFilter | Func<TItem, bool> |
The method used to determine if the item belongs to the dropzone. | |
Reordered | Func<DropZoneOrder<TItem>, Task> |
The callback that is raised when the order of items changed. Only if AllowReorder is enabled. | |
Methods
DropContainer
| Method | Return | Parameters |
|---|---|---|
CancelTransaction | Task | — |
Cancels the drag & drop transaction.
| ||
CommitTransaction | Task | string dropZoneName, bool reorderIsAllowed |
Commits the drag & drop transaction.
| ||
GetTransactionIndex | int | — |
Gets the current transaction index.
| ||
GetTransactionItem | TItem | — |
Gets the item that is currently in the transaction.
| ||
IsOrigin | bool | int index, string zoneName |
Indicates if the supplied name and transaction index are in the current transaction.
| ||
IsTransactionOriginatedFromInside | bool | string zoneName |
Gets the name of the zone where the transaction has started.
| ||
Refresh | void | — |
Request the refresh of the drag container.
| ||
StartTransaction | void | TItem item, string sourceZoneName, int draggableIndex, Func<Task> commited, Func<Task> canceled |
Starts the new drag & drop transaction for the specified item and dropzone.
| ||
UpdateTransactionIndex | void | int index |
Updates the draggable index for the current transaction.
| ||