DxGrid.DropTargetMode Property
Specifies the drop position behavior. Applicable only to drag and drop operations initiated externally.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(GridDropTargetMode.BetweenRows)]
[Parameter]
public GridDropTargetMode DropTargetMode { get; set; }
Property Value
Type | Default | Description |
---|---|---|
GridDropTargetMode | BetweenRows | An enumeration value. |
Available values:
Name | Description | Image |
---|---|---|
BetweenRows | The drop position is defined by TargetItem and DropPosition properties. |
|
Component | The drop position is not defined. You need to implement logic in the ItemsDropped event handler to specify where to insert rows. |
Remarks
Use the DropTargetMode
property to specify the drop position for rows dropped from external components. The BetweenRows
option displays the target indicator at a specific position. You can obtain this position in the ItemsDropped event handler (TargetItem and DropPosition event arguments).
The Component
option may be of use when you want to implement custom insertion logic in the ItemsDropped event handler (for example, if your data is sorted or grouped). The target indicator highlights the entire data area.
Note
If you allow users to sort data, the data source arranges data items based on sort settings. The component cannot guarantee a specific drop position and automatically switches to the Component
mode.
In the following snippet, the first Grid accepts rows from the second Grid. The DropTargetMode
property of the first Grid is Component
.
<DxGrid @ref="@InStockGrid"
Data="InStockProducts"
DropTargetMode="GridDropTargetMode.Component"
ItemsDropped="Grid_ItemsDropped">
<Columns>
<DxGridDataColumn FieldName="ProductName" MinWidth="50" />
<DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c2" />
</Columns>
</DxGrid>
<DxGrid Data="DiscontinuedProducts"
AllowDragRows="true"
AllowedDropTarget="GridAllowedDropTarget.External">
<Columns>
<DxGridDataColumn FieldName="ProductName" MinWidth="50" />
<DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c2" />
</Columns>
</DxGrid>