Class
DocumentStructureCollection

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:

cs-api-definition
public class DocumentStructureCollection

Inheritance: objectDocumentStructureCollection

Constructors

DocumentStructureCollection(LayoutBox)

Declaration

cs-api-definition
public DocumentStructureCollection(LayoutBox rootBox)

Parameters

rootBox

LayoutBox

DocumentStructureCollection(LayoutElement)

Declaration

cs-api-definition
public DocumentStructureCollection(LayoutElement layoutElement)

Parameters

layoutElement

LayoutElement

Properties

EnumerationStack

Represents a stack used for enumerating the document structure collection.

Declaration

cs-api-definition
public BoxParentsStack EnumerationStack { get; }

Property Value

BoxParentsStack

Methods

AddChild(LayoutBox, LayoutBox)

Adds a child LayoutBox to the collection.

Declaration

cs-api-definition
public void AddChild(LayoutBox parent, LayoutBox child)

Parameters

parent

LayoutBox

The parent LayoutBox to which the child will be added.

child

LayoutBox

The child LayoutBox to be added.

AddContainerChildBefore(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddContainerChildBefore(LayoutBox parent, LayoutBox newBox)

Parameters

parent

LayoutBox

The layout box before which the childBox will be added.

newBox

LayoutBox

The layout box to be added as a child container.

AddContainerChildBox(LayoutBox, LayoutBox)

Adds a container child box to the DocumentStructureCollection.

Declaration

cs-api-definition
public void AddContainerChildBox(LayoutBox parent, LayoutBox child)

Parameters

parent

LayoutBox

The parent LayoutBox to which the child will be added.

child

LayoutBox

The child LayoutBox to be added to the parent.

AddContainerSiblingAfter(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddContainerSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)

Parameters

layoutBox

LayoutBox

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

newSibling

LayoutBox

The layout box that will be added as a sibling.

AddContainerSiblingBefore(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddContainerSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)

Parameters

layoutBox

LayoutBox

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

newSibling

LayoutBox

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

AddLeafChildBox(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddLeafChildBox(LayoutBox parent, LayoutBox child)

Parameters

parent

LayoutBox

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

child

LayoutBox

The child layout box to be added as a leaf.

AddLeafSiblingAfter(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddLeafSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)

Parameters

layoutBox

LayoutBox

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

newSibling

LayoutBox

The layout box that will be added as a sibling.

AddLeafSiblingBefore(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddLeafSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)

Parameters

layoutBox

LayoutBox

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

newSibling

LayoutBox

The layout box to be added as a sibling.

AddSiblingAfter(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)

Parameters

layoutBox

LayoutBox

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

newSibling

LayoutBox

The new layout box to be added as a sibling.

AddSiblingBefore(LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void AddSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)

Parameters

layoutBox

LayoutBox

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

newSibling

LayoutBox

The new LayoutBox to be added as a sibling.

ClearChildren(LayoutBox)

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

Declaration

cs-api-definition
public void ClearChildren(LayoutBox layoutBoxParent)

Parameters

layoutBoxParent

LayoutBox

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

GetChildrenCount(LayoutBox)

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

Declaration

cs-api-definition
public static int GetChildrenCount(LayoutBox box)

Parameters

box

LayoutBox

The layout box for which to count the child elements.

Returns

int

The number of child elements within the specified layout box.

GetFirstChild(LayoutBox)

Retrieves the first child DocumentStructureCollection of the specified LayoutBox.

Declaration

cs-api-definition
public static LayoutBox GetFirstChild(LayoutBox box)

Parameters

box

LayoutBox

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.

GetLastChild(LayoutBox)

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

Declaration

cs-api-definition
public static LayoutBox GetLastChild(LayoutBox box)

Parameters

box

LayoutBox

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.

GetNextAssociatedLayoutBox(LayoutBox, DocumentElement)

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

Declaration

cs-api-definition
public static LayoutBox GetNextAssociatedLayoutBox(LayoutBox box, DocumentElement associatedDocumentElement)

Parameters

box

LayoutBox

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

associatedDocumentElement

DocumentElement

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.

GetNextElementOfSameType(LayoutBox)

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

Declaration

cs-api-definition
public static LayoutBox GetNextElementOfSameType(LayoutBox box)

Parameters

box

LayoutBox

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.

GetNextElementOfType(LayoutBox, Type)

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

Declaration

cs-api-definition
public static LayoutBox GetNextElementOfType(LayoutBox box, Type type)

Parameters

box

LayoutBox

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

type

Type

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.

GetNextSibling(LayoutBox)

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

Declaration

cs-api-definition
public static LayoutBox GetNextSibling(LayoutBox box)

Parameters

box

LayoutBox

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.

GetNextSiblingForDocumentElement(LayoutBox, DocumentElement)

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

Declaration

cs-api-definition
public static LayoutBox GetNextSiblingForDocumentElement(LayoutBox box, DocumentElement owner)

Parameters

box

LayoutBox

The layout box in which the document element is located.

owner

DocumentElement

The document element for which to find the next sibling.

Returns

LayoutBox

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

GetNextSiblingForDocumentElementOnSameLevel(LayoutBox, DocumentElement)

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

Declaration

cs-api-definition
public static LayoutBox GetNextSiblingForDocumentElementOnSameLevel(LayoutBox box, DocumentElement owner)

Parameters

box

LayoutBox

The layout box in which the document element resides.

owner

DocumentElement

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.

GetParent(LayoutBox)

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

Declaration

cs-api-definition
public static LayoutBox GetParent(LayoutBox child)

Parameters

child

LayoutBox

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.

GetPreviousElementOfSameType(LayoutBox)

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

Declaration

cs-api-definition
public static LayoutBox GetPreviousElementOfSameType(LayoutBox box)

Parameters

box

LayoutBox

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.

GetPreviousElementOfType(LayoutBox, Type)

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

Declaration

cs-api-definition
public static LayoutBox GetPreviousElementOfType(LayoutBox box, Type type)

Parameters

box

LayoutBox

The layout box from which to retrieve the previous element.

type

Type

The type of element to find.

Returns

LayoutBox

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

GetPreviousSibling(LayoutBox)

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

Declaration

cs-api-definition
public static LayoutBox GetPreviousSibling(LayoutBox box)

Parameters

box

LayoutBox

The layout box for which to find the previous sibling.

Returns

LayoutBox

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

GetPreviousSiblingForDocumentElement(LayoutBox, DocumentElement)

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

Declaration

cs-api-definition
public static LayoutBox GetPreviousSiblingForDocumentElement(LayoutBox box, DocumentElement owner)

Parameters

box

LayoutBox

The layout box associated with the document element.

owner

DocumentElement

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.

GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox, DocumentElement)

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

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Samelevel")]
public static LayoutBox GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox box, DocumentElement owner)

Parameters

box

LayoutBox

The layout box associated with the document element.

owner

DocumentElement

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.

GetRootBox()

Retrieves the root box of the document structure collection.

Declaration

cs-api-definition
public DocumentLayoutBox GetRootBox()

Returns

DocumentLayoutBox

A DocumentLayoutBox representing the root box.

HasChildren(LayoutBox)

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

Declaration

cs-api-definition
public static bool HasChildren(LayoutBox box)

Parameters

box

LayoutBox

The layout box to check for child elements.

Returns

bool

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

MergeContainers()

Merges the container elements within the document structure collection.

Declaration

cs-api-definition
public void MergeContainers()

MergeContainers(LayoutBox)

Merges the specified layout box into the document structure collection.

Declaration

cs-api-definition
public void MergeContainers(LayoutBox fromBox)

Parameters

fromBox

LayoutBox

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

MergeLongWords(ParagraphLayoutBox)

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

Declaration

cs-api-definition
public void MergeLongWords(ParagraphLayoutBox paragraphLayoutBox)

Parameters

paragraphLayoutBox

ParagraphLayoutBox

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

MergeLongWordsFromBox(InlineLayoutBox, DocumentElement)

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

Declaration

cs-api-definition
public void MergeLongWordsFromBox(InlineLayoutBox layoutBox, DocumentElement associatedDocumentElement)

Parameters

layoutBox

InlineLayoutBox

The inline layout box containing the words to be merged.

associatedDocumentElement

DocumentElement

The document element where the merged words will be incorporated.

MergeTableRowBoxes(TableRowLayoutBox, TableRowLayoutBox)

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

Declaration

cs-api-definition
public void MergeTableRowBoxes(TableRowLayoutBox firstRow, TableRowLayoutBox secondRow)

Parameters

firstRow

TableRowLayoutBox

The first table row layout box to merge.

secondRow

TableRowLayoutBox

The second table row layout box to merge.

MergeTwoLayoutBoxes(LayoutBox, LayoutBox, bool)

Merges two layout boxes into a single layout box.

Declaration

cs-api-definition
public void MergeTwoLayoutBoxes(LayoutBox firstBox, LayoutBox secondBox, bool shouldFinalizeRemoval = true)

Parameters

firstBox

LayoutBox

The first layout box to be merged.

secondBox

LayoutBox

The second layout box to be merged.

shouldFinalizeRemoval

bool

Indicates whether to adjust the layout after merging.

RemoveChild(LayoutBox)

Removes the specified child LayoutBox from the collection.

Declaration

cs-api-definition
public void RemoveChild(LayoutBox child)

Parameters

child

LayoutBox

The LayoutBox to be removed from the collection.

RemoveLastChild(LayoutBox)

Removes the last child element from the DocumentStructureCollection.

Declaration

cs-api-definition
public void RemoveLastChild(LayoutBox parent)

Parameters

parent

LayoutBox

The LayoutBox to be removed from the collection.

RemoveLeafSiblingAfter(LayoutBox)

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

Declaration

cs-api-definition
public void RemoveLeafSiblingAfter(LayoutBox layoutBox)

Parameters

layoutBox

LayoutBox

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

ReplaceLayoutBox(LayoutBox, SpanLayoutBox)

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

Declaration

cs-api-definition
public static void ReplaceLayoutBox(LayoutBox boxWithNodeToUpdate, SpanLayoutBox newNodeValue)

Parameters

boxWithNodeToUpdate

LayoutBox

The layout box that will be replaced.

newNodeValue

SpanLayoutBox

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

SplitContainer(LayoutBox, LayoutBox, LayoutBox)

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

Declaration

cs-api-definition
public void SplitContainer(LayoutBox boxToSplit, LayoutBox fromLayoutBox, LayoutBox newLayoutBox)

Parameters

boxToSplit

LayoutBox

The layout box to be split.

fromLayoutBox

LayoutBox

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

newLayoutBox

LayoutBox

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

ToString()

Returns a string representation of the DocumentStructureCollection instance.

Declaration

cs-api-definition
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