Back to Devexpress

LayoutItemDragController Class

windowsforms-devexpress-dot-xtralayout-dot-customization.md

latest3.4 KB
Original Source

LayoutItemDragController Class

Contains methods to move a layout item to a position next to another layout item.

Namespace : DevExpress.XtraLayout.Customization

Assembly : DevExpress.XtraLayout.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public class LayoutItemDragController
vb
Public Class LayoutItemDragController

Remarks

To move an item to a specific position, create a LayoutItemDragController object, initializing the item movement settings via the constructor’s parameters. The object’s settings should specify:

  • which item is to be moved.
  • the item next to which the first item is to be positioned.
  • the position at which the first item needs to be displayed.

After the settings have been initialized, call either the LayoutItemDragController.Drag method (if the item belongs to a LayoutControl) or the LayoutItemDragController.DragWildItem method (if the item doesn’t belong to a LayoutControl).

An alternative to the LayoutItemDragController.Drag method is the BaseLayoutItem.Move method overload, with a LayoutItemDragController object as a parameter.

Example

The following code shows how to move a layout item to a different position via code. An item is moved using the BaseLayoutItem.Move method.

Initially two layout items are displayed one under another:

In the example the second item is positioned on the right of the first layout item.

csharp
using DevExpress.XtraLayout.Utils;
using DevExpress.XtraLayout.Customization;

LayoutItemDragController dragController = new LayoutItemDragController(layoutControlItem2, 
  layoutControlItem1, MoveType.Inside, InsertLocation.After, LayoutType.Horizontal);
layoutControlItem2.Move(dragController);
vb
Imports DevExpress.XtraLayout.Utils
Imports DevExpress.XtraLayout.Customization

Dim dragController As LayoutItemDragController = _
  New LayoutItemDragController(layoutControlItem2, layoutControlItem1, _
  MoveType.Inside, InsertLocation.After, LayoutType.Horizontal)
layoutControlItem2.Move(dragController)

Inheritance

Object LayoutItemDragController

See Also

LayoutItemDragController Members

DevExpress.XtraLayout.Customization Namespace