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.