LayoutIterator Class
Navigates the layout tree and provides access to individual elements.
Namespace: DevExpress.XtraRichEdit.API.Layout
Assembly: DevExpress.RichEdit.v24.1.Core.dll
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation
Declaration
Remarks
The LayoutIterator enables you to traverse the document layout tree, iterate over nodes and access layout elements.
A simple hierarchical structure of the document layout is shown in the following image. To specify layout levels, the LayoutLevel enumeration is used.
To start iterating, create an instance of the LayoutIterator using one of LayoutIterator constructors for the current DocumentLayout. Advance the iterator with the LayoutIterator.MoveNext method. A current layout element is available using the LayoutIterator.Current property.
You can use LayoutIterator.MovePrevious method to move in the opposite direction or LayoutIterator.Reset to rewind the iterator.
When the iterator cannot move further, the MoveNext or MovePrevious methods return false. The LayoutIterator.IsStart and LayoutIterator.IsEnd properties indicate whether the reason for the stop is the boundaries of the available range. Another reason can be the absence of a layout element at the level specified in the call to the LayoutIterator.MoveNext method overload.
If the document layout is modified, a call to the MoveNext or MovePrevious methods results in InvalidOperationException. To prevent this, check for the LayoutIterator.IsLayoutValid property value, and iterate only if it is true.