.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Box

LayoutIterator.MoveNext() Method

Navigates to the next layout element in the layout tree.

Namespace: DevExpress.XtraRichEdit.API.Layout

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

Declaration

public bool MoveNext()

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

Example

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.

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.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
    MessageBox.Show(s)
End If

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

Note

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