Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

LayoutController.Move(BaseLayoutItem, BaseLayoutItem, MoveType, Int32) Method

Moves the BaseLayoutItem next to another item or into another group at the precise position, specified by an insertIndex parameter.

Namespace: DevExpress.Xpf.Docking

Assembly: DevExpress.Xpf.Docking.v24.2.dll

NuGet Package: DevExpress.Wpf.Docking

#Declaration

public bool Move(
    BaseLayoutItem item,
    BaseLayoutItem target,
    MoveType type,
    int insertIndex
)

#Parameters

Name Type Description
item BaseLayoutItem

A BaseLayoutItem to move.

target BaseLayoutItem

A BaseLayoutItem in relation to which the specified element is moved.

type MoveType

A DevExpress.Xpf.Layout.Core.MoveType enumeration value specifying how the item is moved.

insertIndex Int32

An integer value that specifies the zero-based index at which the BaseLayoutItem should be inserted. If it is negative or exceeds the number of items within the target container, an exception is thrown.

#Returns

Type Description
Boolean

true if the item has been sucsessfully moved; otherwise, false.

#Remarks

An item cannot be moved if the BaseLayoutItem.AllowMove option is disabled. After an item has been moved, the DockLayoutManager.LayoutItemMoved event fires.

The insertIndex parameter only makes sense if the type parameter is set to the MoveType.InsideGroup.

Below is an example of re-arranging LayoutControlItems via the Move method. The item ‘Control item 3’ is being moved from ‘myGroup2’ to ‘myGroup1’ and placed between two existing ‘myGroup1’ items:

DXDocking Move Method Result

private void Button_Click(object sender, RoutedEventArgs e) {
    //Moving the controlItem3 to the first group and placing it between existing items (insertIndex = 1)
    dockLayoutManager1.LayoutController.Move(controlItem3, myGroup1, DevExpress.Xpf.Layout.Core.MoveType.InsideGroup, 1); }
See Also