Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Box

LayoutIterator.MovePrevious() Method

Navigates to the previous layout element in the layout tree.

Namespace: DevExpress.XtraRichEdit.API.Layout

Assembly: DevExpress.RichEdit.v19.1.Core.dll

Declaration

public bool MovePrevious()

Returns

Type Description
Boolean

True, on a successful navigation; otherwise, false.

Remarks

If navigation is successful, the LayoutIterator.Current property contains the layout element to which the LayoutIterator has moved.

The MovePrevious method can be used to traverse the entire document layout tree. It uses pre-order depth-first traversal. The iterator navigates to the left node of the same LayoutLevel. When there are no more nodes on the left, it goes up to the parent level and accesses the left parent node. Subsequently the iterator navigates to the rightmost child node, and so on.

Example

Dim result As Boolean = False
Dim s As String = String.Empty
' Create a new iterator if the document has been changed and the layout is updated.
If Not layoutIterator.IsLayoutValid Then
    CreateNewIterator()
End If

Select Case barEditItemRgLevel.EditValue.ToString()
    Case "Any"
        result = layoutIterator.MovePrevious()
    Case "Level"
        result = layoutIterator.MovePrevious(CType(cmbLayoutLevel.EditValue, LayoutLevel))
    Case "LevelWithinParent"
        result = layoutIterator.MovePrevious(CType(cmbLayoutLevel.EditValue, LayoutLevel), False)
End Select

If Not result Then
    s = "Cannot move."
    If layoutIterator.IsStart Then
        s &= ControlChars.Lf & "Start is reached."
    ElseIf layoutIterator.IsEnd Then
        s &= ControlChars.Lf & "End is reached."
    End If
        MessageBox.Show(s)
End If
See Also