Back to Devexpress

TileControl.EndItemDragging Event

windowsforms-devexpress-dot-xtraeditors-dot-tilecontrol-1890659f.md

latest4.8 KB
Original Source

TileControl.EndItemDragging Event

Fires after the dragged tile item is released.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Behavior")]
public event TileItemDragEventHandler EndItemDragging
vb
<DXCategory("Behavior")>
Public Event EndItemDragging As TileItemDragEventHandler

Event Data

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

PropertyDescription
CancelGets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
ItemGets or sets a tile item that fired an event which takes the TileItemDragEventArgs object as a parameter.
TargetGroupGets the TileGroup to which a TileItem being dragged is about to be placed.

Remarks

The EndItemDragging event occurs immediately after a dragged TileItem is released. Handle it to get which item is being dragged and/or the destination and source TileGroups it was dragged to. The example below demonstrates how to obtain both of these groups.

csharp
private void tileControl1_EndItemDragging(object sender, DevExpress.XtraEditors.TileItemDragEventArgs e) {
    //source group
    DevExpress.XtraEditors.TileGroup sourceGroup = e.Item.Group;
    //destination group
    DevExpress.XtraEditors.TileGroup destinationGroup = e.TargetGroup;
}
vb
Private Sub tileControl1_EndItemDragging(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.TileItemDragEventArgs)
    'source group
    Dim sourceGroup As DevExpress.XtraEditors.TileGroup = e.Item.Group
    'destination group
    Dim destinationGroup As DevExpress.XtraEditors.TileGroup = e.TargetGroup
End Sub

You can also handle the EndItemDragging event to prevent specific drag-and-drop operations by setting the Cancel property to true.

csharp
private void tileControl1_EndItemDragging(object sender, DevExpress.XtraEditors.TileItemDragEventArgs e) {
    if (. . .) e.Cancel = true;
}
vb
Private Sub tileControl1_EndItemDragging(ByVal sender As Object, ByVal e As DevExpress.XtraEditors.TileItemDragEventArgs)
    If ... Then
    e.Cancel = True
    End If
End Sub

Note

When the drag operation is started, an item bitmap is created and used for the current drag animation. Therefore, do not modify any appearance settings of a dragged tile (like the AppearanceObject.BackColor property) when handling the EndItemDragging event.

Note

Do not modify tile and group properties within the EndItemDragging event handler. You can only customize the target group’s properties if this group is new and did not exist before the dragging.

The EndItemDragging event is the opposite of the TileControl.StartItemDragging event. Both of these events are fired if the TileControl.AllowDrag property is set to true.

See Also

StartItemDragging

TargetGroup

AllowDrag

AllowDragTilesBetweenGroups

TileControl Class

TileControl Members

DevExpress.XtraEditors Namespace