TileView.BeforeItemDrop Event

Fires when a tile drop operation is initiated. This event does not fire when you enable drag-and-drop using Drag And Drop Behavior.

Namespace: DevExpress.XtraGrid.Views.Tile

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

[DXCategory("Action")]
public event TileViewBeforeItemDropEventHandler BeforeItemDrop
<DXCategory("Action")>
Public Event BeforeItemDrop As TileViewBeforeItemDropEventHandler

Event Data

The BeforeItemDrop event's data class is BeforeItemDropEventArgs. The following properties provide information specific to this event:

Property Description
GroupColumnValue Gets the value of the current group from which the tile has been dragged.
Handled Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.
IndexInGroup Gets the visible index of the current tile in its original group.
KanbanGroup Gets the KanbanGroup that owns the current tile. This property is in effect if you created KanbanGroups via the TileViewOptionsKanban.Groups collection. Otherwise, this property returns null.
ListSourceRowIndex Gets the tile's index in the data source.
NewGroupColumnValue Gets the value of the new group to which the tile is about to be dropped.
NewKanbanGroup Gets the KanbanGroup to which the tile is about to be dropped. This property is in effect if you created KanbanGroups via the TileViewOptionsKanban.Groups collection. Otherwise, this property returns null.
NewListSourceRowIndex Gets the tile's new index in the data source at which the tile is about to be inserted.
RowHandle Gets the current row handle of the tile.
TargetIndexInGroup Gets the position at which the current item is about to be dropped within the target group.

Remarks

Use the TileView.OptionsDragDrop.AllowDrag setting to enable the built-in tile drag-and-drop feature.

Tile drag-and-drop operations are reflected on the data source level. When a tile is dropped at a certain position, the Tile View fires the BeforeItemDrop event just before moving the tile's underlying data record to new position (NewListSourceRowIndex) in the data source. You can handle the BeforeItemDrop event to do the following:

  • Move the tile's record to a custom position, instead of the calculated position. To accomplish this, assign a new record position to the BeforeItemDropEventArgs.NewListSourceRowIndex property, and leave the event's Handled parameter set to false. The Tile View will move the record to the specified position after your BeforeItemDrop event handler is complete.
  • Manually move the tile's record to a new position using the methods provided by your data source. Don't forget to set the event's Handled parameter to true, to indicate that no default processing is required after your BeforeItemDrop event handler is completed.

Tiles can be combined into groups by specifying the group column (TileViewColumns.GroupColumn). If a tile is moved from one group to another group, the underlying record's group field (GroupColumn.FieldName) needs to be changed accordingly. After your BeforeItemDrop event handler is complete, the Tile View will set the underlying record's group field to the NewGroupColumnValue parameter value (provided that the event's Handled parameter is false).

See Also