Skip to main content
.NET Framework 4.5.2+

LayoutIterator.MoveNext() Method

Navigates to the next layout element in the layout tree.

Namespace: DevExpress.XtraRichEdit.API.Layout

Assembly: DevExpress.RichEdit.v22.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core


public bool MoveNext()


Type Description

True, on a successful navigation; otherwise, false.


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

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


This code snippet calls different LayoutIterator.MoveNext overloads to illustrate different techniques of tree navigation. Checking the LayoutIterator.IsLayoutValid value is required because the user can modify the document layout in the meantime.

The LayoutIterator.IsStart and LayoutIterator.IsEnd properties indicate whether the iterator reached the start or end of the range for which it has been created, respectively.

View 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
End If

Select Case barEditItemRgLevel.EditValue.ToString()
    Case "Any"
        result = layoutIterator.MoveNext()
    Case "Level"
        result = layoutIterator.MoveNext(CType(cmbLayoutLevel.EditValue, LayoutLevel))
    Case "LevelWithinParent"
        result = layoutIterator.MoveNext(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
End If

The following code snippets (auto-collected from DevExpress Examples) contain references to the MoveNext() method.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also