New to Telerik UI for WPFStart a free 30-day trial

Represents a collection of document structure elements for managing and manipulating document layouts.

Definition

Namespace:Telerik.Windows.Documents.DocumentStructure

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

C#
public class DocumentStructureCollection

Inheritance: objectDocumentStructureCollection

Constructors

C#
public DocumentStructureCollection(LayoutBox rootBox)
Parameters:rootBoxLayoutBox
C#
public DocumentStructureCollection(LayoutElement layoutElement)
Parameters:layoutElementLayoutElement

Properties

Represents a stack used for enumerating the document structure collection.

C#
public BoxParentsStack EnumerationStack { get; }

Methods

Adds a child LayoutBox to the collection.

C#
public void AddChild(LayoutBox parent, LayoutBox child)
Parameters:parentLayoutBox

The parent LayoutBox to which the child will be added.

childLayoutBox

The child LayoutBox to be added.

Adds a container child before a specified layout box in the document structure collection.

C#
public void AddContainerChildBefore(LayoutBox parent, LayoutBox newBox)
Parameters:parentLayoutBox

The layout box before which the childBox will be added.

newBoxLayoutBox

The layout box to be added as a child container.

Adds a container child box to the DocumentStructureCollection.

C#
public void AddContainerChildBox(LayoutBox parent, LayoutBox child)
Parameters:parentLayoutBox

The parent LayoutBox to which the child will be added.

childLayoutBox

The child LayoutBox to be added to the parent.

Adds a new container sibling after the specified layout box in the document structure collection.

C#
public void AddContainerSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
Parameters:layoutBoxLayoutBox

The layout box after which the new container sibling will be added.

newSiblingLayoutBox

The layout box that will be added as a sibling.

Adds a container sibling before the specified layout box in the document structure collection.

C#
public void AddContainerSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
Parameters:layoutBoxLayoutBox

The layout box before which the new container sibling will be added.

newSiblingLayoutBox

The new container layout box to be added as a sibling.

Adds a leaf child box to the specified parent box within the document structure collection.

C#
public void AddLeafChildBox(LayoutBox parent, LayoutBox child)
Parameters:parentLayoutBox

The parent layout box to which the child box will be added.

childLayoutBox

The child layout box to be added as a leaf.

Adds a leaf sibling after the specified layout box in the document structure collection.

C#
public void AddLeafSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
Parameters:layoutBoxLayoutBox

The layout box to which the new sibling will be added after.

newSiblingLayoutBox

The layout box that will be added as a sibling.

Adds a leaf sibling element before the specified layout box in the document structure collection.

C#
public void AddLeafSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
Parameters:layoutBoxLayoutBox

The layout box before which the new sibling will be added.

newSiblingLayoutBox

The layout box to be added as a sibling.

Adds a sibling layout box after the specified layout box in the document structure collection.

C#
public void AddSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
Parameters:layoutBoxLayoutBox

The layout box to which the new sibling will be added after.

newSiblingLayoutBox

The new layout box to be added as a sibling.

Adds a sibling LayoutBox before the specified LayoutBox in the collection.

C#
public void AddSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
Parameters:layoutBoxLayoutBox

The existing LayoutBox before which the new sibling will be added.

newSiblingLayoutBox

The new LayoutBox to be added as a sibling.

Clears the children of the specified layout box from the document structure collection.

C#
public void ClearChildren(LayoutBox layoutBoxParent)
Parameters:layoutBoxParentLayoutBox

The layout box whose children will be cleared from the collection.

Retrieves the number of child elements contained within the specified layout box.

C#
public static int GetChildrenCount(LayoutBox box)
Parameters:boxLayoutBox

The layout box for which to count the child elements.

Returns:

int

The number of child elements within the specified layout box.

Retrieves the first child DocumentStructureCollection of the specified LayoutBox.

C#
public static LayoutBox GetFirstChild(LayoutBox box)
Parameters:boxLayoutBox

The layout box from which to retrieve the first child document.

Returns:

LayoutBox

The first child LayoutBox within the specified layout box, or null if no children exist.

Retrieves the last child element of the specified layout box in the document structure collection.

C#
public static LayoutBox GetLastChild(LayoutBox box)
Parameters:boxLayoutBox

The layout box from which to retrieve the last child.

Returns:

LayoutBox

The last child element of the specified layout box, or null if the layout box has no children.

Retrieves the next associated layout box for the specified layout box and document element.

C#
public static LayoutBox GetNextAssociatedLayoutBox(LayoutBox box, DocumentElement associatedDocumentElement)
Parameters:boxLayoutBox

The layout box for which to find the next associated layout box.

associatedDocumentElementDocumentElement

The document element that is associated with the layout box.

Returns:

LayoutBox

The next associated layout box, or null if no associated layout box is found.

Retrieves the next element of the same type as the specified layout box within the document structure collection.

C#
public static LayoutBox GetNextElementOfSameType(LayoutBox box)
Parameters:boxLayoutBox

The layout box for which the next element of the same type is to be found.

Returns:

LayoutBox

Returns the next element of the same type as the specified layout box, or null if no such element exists.

Retrieves the next element of the specified type from the document structure collection, starting from the given layout box.

C#
public static LayoutBox GetNextElementOfType(LayoutBox box, Type type)
Parameters:boxLayoutBox

The starting layout box from which to search for the next element.

typeType

The type of the element to find within the document structure collection.

Returns:

LayoutBox

The next element of the specified type if found; otherwise, null.

Retrieves the next sibling element in the document structure for the specified layout box.

C#
public static LayoutBox GetNextSibling(LayoutBox box)
Parameters:boxLayoutBox

The layout box for which to find the next sibling in the document structure.

Returns:

LayoutBox

A LayoutBox representing the next sibling, or null if there is no next sibling.

Retrieves the next sibling element for a specified document element within a layout box.

C#
public static LayoutBox GetNextSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
Parameters:boxLayoutBox

The layout box in which the document element is located.

ownerDocumentElement

The document element for which to find the next sibling.

Returns:

LayoutBox

The next sibling document element if it exists; otherwise, null.

Retrieves the next sibling document element that is on the same level in the document structure as the specified document element.

C#
public static LayoutBox GetNextSiblingForDocumentElementOnSameLevel(LayoutBox box, DocumentElement owner)
Parameters:boxLayoutBox

The layout box in which the document element resides.

ownerDocumentElement

The document element for which the next sibling is to be found.

Returns:

LayoutBox

The next sibling document element on the same level, or null if there is no such sibling.

Retrieves the parent element of the specified layout box within the document structure collection.

C#
public static LayoutBox GetParent(LayoutBox child)
Parameters:childLayoutBox

The layout box for which to find the parent element.

Returns:

LayoutBox

The parent element of the specified layout box, or null if the layout box does not have a parent.

Retrieves the previous element of the same type as the specified layout box within the document structure collection.

C#
public static LayoutBox GetPreviousElementOfSameType(LayoutBox box)
Parameters:boxLayoutBox

The layout box for which to find the previous element of the same type.

Returns:

LayoutBox

Returns the previous element of the same type if found; otherwise, returns null.

Retrieves the previous element of the specified type from a given layout box.

C#
public static LayoutBox GetPreviousElementOfType(LayoutBox box, Type type)
Parameters:boxLayoutBox

The layout box from which to retrieve the previous element.

typeType

The type of element to find.

Returns:

LayoutBox

The previous element of the specified type if found; otherwise, null.

Retrieves the previous sibling of the specified layout box within the document structure collection.

C#
public static LayoutBox GetPreviousSibling(LayoutBox box)
Parameters:boxLayoutBox

The layout box for which to find the previous sibling.

Returns:

LayoutBox

The previous sibling layout box if it exists; otherwise, null.

Retrieves the previous sibling of the specified document element within the document structure collection.

C#
public static LayoutBox GetPreviousSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
Parameters:boxLayoutBox

The layout box associated with the document element.

ownerDocumentElement

The document element for which the previous sibling is to be retrieved.

Returns:

LayoutBox

Returns the previous sibling document element if it exists; otherwise, returns null.

Retrieves the previous sibling of the specified document element at the same level in the document structure.

C#
public static LayoutBox GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox box, DocumentElement owner)
Parameters:boxLayoutBox

The layout box associated with the document element.

ownerDocumentElement

The document element for which to find the previous sibling.

Returns:

LayoutBox

The previous sibling document element at the same level if found; otherwise, null.

Retrieves the root box of the document structure collection.

C#
public DocumentLayoutBox GetRootBox()
Returns:

DocumentLayoutBox

A DocumentLayoutBox representing the root box.

Determines whether the specified layout box has any child elements in the document structure collection.

C#
public static bool HasChildren(LayoutBox box)
Parameters:boxLayoutBox

The layout box to check for child elements.

Returns:

bool

Returns true if the layout box has children; otherwise, false.

Merges the container elements within the document structure collection.

C#
public void MergeContainers()

Merges the specified layout box into the document structure collection.

C#
public void MergeContainers(LayoutBox fromBox)
Parameters:fromBoxLayoutBox

The layout box to be merged into the document structure collection.

Merges long words in the specified paragraph layout box within the document structure collection.

C#
public void MergeLongWords(ParagraphLayoutBox paragraphLayoutBox)
Parameters:paragraphLayoutBoxParagraphLayoutBox

The paragraph layout box that contains the long words to be merged.

Merges long words from the specified layout box into the provided document element.

C#
public void MergeLongWordsFromBox(InlineLayoutBox layoutBox, DocumentElement associatedDocumentElement)
Parameters:layoutBoxInlineLayoutBox

The inline layout box containing the words to be merged.

associatedDocumentElementDocumentElement

The document element where the merged words will be incorporated.

Merges two table row layout boxes into a single row layout box.

C#
public void MergeTableRowBoxes(TableRowLayoutBox firstRow, TableRowLayoutBox secondRow)
Parameters:firstRowTableRowLayoutBox

The first table row layout box to merge.

secondRowTableRowLayoutBox

The second table row layout box to merge.

Merges two layout boxes into a single layout box.

C#
public void MergeTwoLayoutBoxes(LayoutBox firstBox, LayoutBox secondBox, bool shouldFinalizeRemoval = true)
Parameters:firstBoxLayoutBox

The first layout box to be merged.

secondBoxLayoutBox

The second layout box to be merged.

shouldFinalizeRemovalbool

Indicates whether to adjust the layout after merging.

Removes the specified child LayoutBox from the collection.

C#
public void RemoveChild(LayoutBox child)
Parameters:childLayoutBox

The LayoutBox to be removed from the collection.

Removes the last child element from the DocumentStructureCollection.

C#
public void RemoveLastChild(LayoutBox parent)
Parameters:parentLayoutBox

The LayoutBox to be removed from the collection.

Removes the leaf sibling that appears after the specified layout box in the document structure collection.

C#
public void RemoveLeafSiblingAfter(LayoutBox layoutBox)
Parameters:layoutBoxLayoutBox

The layout box after which the leaf sibling will be removed.

Replaces an existing layout box in the document structure collection with a new span layout box.

C#
public static void ReplaceLayoutBox(LayoutBox boxWithNodeToUpdate, SpanLayoutBox newNodeValue)
Parameters:boxWithNodeToUpdateLayoutBox

The layout box that will be replaced.

newNodeValueSpanLayoutBox

The span layout box that will replace the old layout box.

Splits a container into multiple layout boxes based on the specified layout boxes.

C#
public void SplitContainer(LayoutBox boxToSplit, LayoutBox fromLayoutBox, LayoutBox newLayoutBox)
Parameters:boxToSplitLayoutBox

The layout box to be split.

fromLayoutBoxLayoutBox

The layout box that will represent the first part after the split.

newLayoutBoxLayoutBox

The layout box that will represent the second part after the split.

Returns a string representation of the DocumentStructureCollection instance.

C#
public override string ToString()
Returns:

string

A string that represents the current DocumentStructureCollection object.

Overrides: object.ToString()

In this article
DefinitionConstructorsDocumentStructureCollection(LayoutBox)DocumentStructureCollection(LayoutElement)PropertiesEnumerationStackMethodsAddChild(LayoutBox, LayoutBox)AddContainerChildBefore(LayoutBox, LayoutBox)AddContainerChildBox(LayoutBox, LayoutBox)AddContainerSiblingAfter(LayoutBox, LayoutBox)AddContainerSiblingBefore(LayoutBox, LayoutBox)AddLeafChildBox(LayoutBox, LayoutBox)AddLeafSiblingAfter(LayoutBox, LayoutBox)AddLeafSiblingBefore(LayoutBox, LayoutBox)AddSiblingAfter(LayoutBox, LayoutBox)AddSiblingBefore(LayoutBox, LayoutBox)ClearChildren(LayoutBox)GetChildrenCount(LayoutBox)GetFirstChild(LayoutBox)GetLastChild(LayoutBox)GetNextAssociatedLayoutBox(LayoutBox, DocumentElement)GetNextElementOfSameType(LayoutBox)GetNextElementOfType(LayoutBox, Type)GetNextSibling(LayoutBox)GetNextSiblingForDocumentElement(LayoutBox, DocumentElement)GetNextSiblingForDocumentElementOnSameLevel(LayoutBox, DocumentElement)GetParent(LayoutBox)GetPreviousElementOfSameType(LayoutBox)GetPreviousElementOfType(LayoutBox, Type)GetPreviousSibling(LayoutBox)GetPreviousSiblingForDocumentElement(LayoutBox, DocumentElement)GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox, DocumentElement)GetRootBox()HasChildren(LayoutBox)MergeContainers()MergeContainers(LayoutBox)MergeLongWords(ParagraphLayoutBox)MergeLongWordsFromBox(InlineLayoutBox, DocumentElement)MergeTableRowBoxes(TableRowLayoutBox, TableRowLayoutBox)MergeTwoLayoutBoxes(LayoutBox, LayoutBox, bool)RemoveChild(LayoutBox)RemoveLastChild(LayoutBox)RemoveLeafSiblingAfter(LayoutBox)ReplaceLayoutBox(LayoutBox, SpanLayoutBox)SplitContainer(LayoutBox, LayoutBox, LayoutBox)ToString()
Not finding the help you need?
Contact Support