Skip to main content

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.v23.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

<dxdo:LayoutGroup Orientation="Vertical">
    <!--First Group-->
    <dxdo:LayoutGroup Orientation="Vertical" Name="myGroup1" GroupBorderStyle="GroupBox">
        <dxdo:LayoutControlItem Name="controlItem1" Caption="Control Item 1">
            <TextBox>AAAAA</TextBox>
        </dxdo:LayoutControlItem>
        <dxdo:LayoutControlItem Name="controlItem2" Caption="Control Item 2">
            <TextBox>BBBBB</TextBox>
        </dxdo:LayoutControlItem>
    </dxdo:LayoutGroup>
    <!--Second Group-->
    <dxdo:LayoutGroup Orientation="Vertical" Name="myGroup2" GroupBorderStyle="GroupBox">
        <dxdo:LayoutControlItem Name="controlItem3" Caption="Move me">
            <TextBox>CCCCC</TextBox>
        </dxdo:LayoutControlItem>
        <dxdo:LayoutControlItem Name="controlItem4" Caption="Re-arrage items">
            <Button Content="^" Click="Button_Click"/>
        </dxdo:LayoutControlItem>
    </dxdo:LayoutGroup>
</dxdo:LayoutGroup>
See Also