Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

MoveStyleEnum Enumeration

Used with the ItemClass.Move method to define how the item is moved.

Class: (none)
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public enum MoveStyleEnum;
Public Enum MoveStyleEnum

Values

NameDescription
BeforeTargetAsSiblingThe item is inserted before the target item as the target item's sibling. If the item and the target item are the same, the Move method has no effect. The Move method's ItemTarget parameter is required. The target item cannot be a child item of the item to be moved.
AfterTargetAsSiblingThe item is inserted after the target item as the target item's sibling. If the item and the target item are the same, the Move method has no effect. The Move method's ItemTarget parameter is required. The target item cannot be a child item of the item to be moved.
TargetAsParentInsertFirstThe item is added as the target item's first child item. If the item and the target item are the same, the Move method has no effect. The Move method's ItemTarget parameter is required. The target item cannot be a child item of the item to be moved.
TargetAsParentAddThe item is added as the target item's last child item. If the item and the target item are the same, the Move method has no effect. The Move method's ItemTarget parameter is required. The target item cannot be a child item of the item to be moved.
UpHierarchyThe item is moved up the hierarchy by one position and becomes the sibling item of the visible item that precedes it. If the item is already the first item in the tree control, the Move method has no effect. The Move method's ItemTarget parameter must be set to null/Nothing.
DownHierarchyThe item is moved down the hierarchy by one position. If the following, visible item is expanded, it becomes that item's first child item. If the following, visible item is collapsed, it becomes that item's next sibling item. If the item is already the last item in the tree control, the Move method has no effect. The Move method's ItemTarget parameter must be set to null/Nothing.
UpSiblingThe item is moved up by one position and becomes the previous sibling item's previous sibling. If the item is already the first sibling, the Move method has no effect. The Move method's ItemTarget parameter must be set to null/Nothing.
DownSiblingThe item is moved down by one position and becomes the next sibling item's next sibling. If the item is already the last sibling, the Move method has no effect. The Move method's ItemTarget parameter must be set to null/Nothing.

Comments

Used with the ItemClass.Move method to define how the item is moved.

Examples

C#

            Debug.Write("sftTree1_DragDrop ");
            DumpValues(e);
            if (sftTree1.DropTarget != null && e.Data.GetDataPresent(typeof(ItemClass))) {
                ItemClass originalItem = (ItemClass)e.Data.GetData(typeof(ItemClass));
                ItemClass targetItem = (ItemClass)sftTree1.DropTarget;
                ItemClass newItem = null;
                if (e.Effect == DragDropEffects.Move) {
                    try {
                        newItem = originalItem.Move(targetItem, MoveStyleEnum.TargetAsParentInsertFirst);
                    } catch (Exception exc) {
                        MessageBox.Show(exc.Message);
                    }
                } else {
                    try {
                        newItem = originalItem.Copy(targetItem, CopyStyleEnum.TargetAsParentInsertFirst, true);
                    } catch (Exception exc) {

VB.NET

    Debug.Write("sftTree1_DragDrop ")
    DumpValues(e)
    If Not SftTree1.DropTarget Is Nothing And e.Data.GetDataPresent(GetType(ItemClass)) Then
        Dim originalItem As ItemClass = e.Data.GetData(GetType(ItemClass))
        Dim targetItem As ItemClass = SftTree1.DropTarget
        Dim newItem As ItemClass = Nothing
        If e.Effect = DragDropEffects.Move Then
            Try
                newItem = originalItem.Move(targetItem, MoveStyleEnum.TargetAsParentInsertFirst)
            Catch exc As Exception
                MessageBox.Show(exc.Message)
            End Try
        Else
            Try
                newItem = originalItem.Copy(targetItem, CopyStyleEnum.TargetAsParentInsertFirst, True)
            Catch exc As Exception

See Also | Classes | SftTree/NET 2.0