Skip to main content
A newer version of this page is available. .

TileView.BeforeItemDrop Event

Fires when a tile drop operation is initiated.

Namespace: DevExpress.XtraGrid.Views.Tile

Assembly: DevExpress.XtraGrid.v19.1.dll

Declaration

[DXCategory("Action")]
public event TileViewBeforeItemDropEventHandler BeforeItemDrop

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 (the TileViewColumns.GroupColumn‘s value) 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.
ListSourceRowIndex Gets the tile’s index in the data source.
NewGroupColumnValue Gets the value of the new group (the TileViewColumns.GroupColumn‘s value) to which the tile is about to be dropped.
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.

Remarks

The built-in tile drag-and-drop feature can be enabled with the TileViewOptionsDragDrop.AllowDrag setting (available from the TileView.OptionsDragDrop property). Using the following events, you can customize and handle built-in drag-and-drop operations:

  • TileView.BeforeItemDrag - Fires when a tile drag operation is about to be started. Allows you to provide a drag image, or to cancel the operation.
  • TileView.BeforeItemDrop - Fires when a tile drop operation is initiated.
  • TileView.ItemDrop - Fires after a tile drop operation has been completed.

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