ClassDocumentStructureCollection
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:
public class DocumentStructureCollection
Inheritance: objectDocumentStructureCollection
Constructors
DocumentStructureCollection(LayoutBox)
Declaration
public DocumentStructureCollection(LayoutBox rootBox)
Parameters
rootBox
DocumentStructureCollection(LayoutElement)
Declaration
public DocumentStructureCollection(LayoutElement layoutElement)
Parameters
layoutElement
Properties
EnumerationStack
Represents a stack used for enumerating the document structure collection.
Declaration
public BoxParentsStack EnumerationStack { get; }
Property Value
Methods
AddChild(LayoutBox, LayoutBox)
Adds a child LayoutBox to the collection.
AddContainerChildBefore(LayoutBox, LayoutBox)
Adds a container child before a specified layout box in the document structure collection.
AddContainerChildBox(LayoutBox, LayoutBox)
Adds a container child box to the DocumentStructureCollection.
AddContainerSiblingAfter(LayoutBox, LayoutBox)
Adds a new container sibling after the specified layout box in the document structure collection.
AddContainerSiblingBefore(LayoutBox, LayoutBox)
Adds a container sibling before the specified layout box in the document structure collection.
AddLeafChildBox(LayoutBox, LayoutBox)
Adds a leaf child box to the specified parent box within the document structure collection.
AddLeafSiblingAfter(LayoutBox, LayoutBox)
Adds a leaf sibling after the specified layout box in the document structure collection.
AddLeafSiblingBefore(LayoutBox, LayoutBox)
Adds a leaf sibling element before the specified layout box in the document structure collection.
AddSiblingAfter(LayoutBox, LayoutBox)
Adds a sibling layout box after the specified layout box in the document structure collection.
ClearChildren(LayoutBox)
Clears the children of the specified layout box from the document structure collection.
Declaration
public void ClearChildren(LayoutBox layoutBoxParent)
Parameters
layoutBoxParent
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.
GetFirstChild(LayoutBox)
Retrieves the first child DocumentStructureCollection of the specified LayoutBox.
GetLastChild(LayoutBox)
Retrieves the last child element of the specified layout box in the document structure collection.
GetNextAssociatedLayoutBox(LayoutBox, DocumentElement)
Retrieves the next associated layout box for the specified layout box and document element.
Declaration
public static LayoutBox GetNextAssociatedLayoutBox(LayoutBox box, DocumentElement associatedDocumentElement)
Parameters
box
The layout box for which to find the next associated layout box.
associatedDocumentElement
The document element that is associated with the layout box.
Returns
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
public static LayoutBox GetNextElementOfSameType(LayoutBox box)
Parameters
box
The layout box for which the next element of the same type is to be found.
Returns
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
public static LayoutBox GetNextElementOfType(LayoutBox box, Type type)
Parameters
box
The starting layout box from which to search for the next element.
type
The type of the element to find within the document structure collection.
Returns
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.
GetNextSiblingForDocumentElement(LayoutBox, DocumentElement)
Retrieves the next sibling element for a specified document element within a layout box.
Declaration
public static LayoutBox GetNextSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
Parameters
box
The layout box in which the document element is located.
owner
The document element for which to find the next sibling.
Returns
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
public static LayoutBox GetNextSiblingForDocumentElementOnSameLevel(LayoutBox box, DocumentElement owner)
Parameters
box
The layout box in which the document element resides.
owner
The document element for which the next sibling is to be found.
Returns
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.
GetPreviousElementOfSameType(LayoutBox)
Retrieves the previous element of the same type as the specified layout box within the document structure collection.
GetPreviousElementOfType(LayoutBox, Type)
Retrieves the previous element of the specified type from a given layout box.
Declaration
public static LayoutBox GetPreviousElementOfType(LayoutBox box, Type type)
Parameters
box
The layout box from which to retrieve the previous element.
type
The type of element to find.
Returns
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.
GetPreviousSiblingForDocumentElement(LayoutBox, DocumentElement)
Retrieves the previous sibling of the specified document element within the document structure collection.
Declaration
public static LayoutBox GetPreviousSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
Parameters
box
The layout box associated with the document element.
owner
The document element for which the previous sibling is to be retrieved.
Returns
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
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Samelevel")]
public static LayoutBox GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox box, DocumentElement owner)
Parameters
box
The layout box associated with the document element.
owner
The document element for which to find the previous sibling.
Returns
The previous sibling document element at the same level if found; otherwise, null.
GetRootBox()
Retrieves the root box of the document structure collection.
Declaration
public DocumentLayoutBox GetRootBox()
Returns
A DocumentLayoutBox representing the root box.
HasChildren(LayoutBox)
Determines whether the specified layout box has any child elements in the document structure collection.
MergeContainers()
Merges the container elements within the document structure collection.
Declaration
public void MergeContainers()
MergeContainers(LayoutBox)
Merges the specified layout box into the document structure collection.
Declaration
public void MergeContainers(LayoutBox fromBox)
Parameters
fromBox
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
public void MergeLongWords(ParagraphLayoutBox paragraphLayoutBox)
Parameters
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
public void MergeLongWordsFromBox(InlineLayoutBox layoutBox, DocumentElement associatedDocumentElement)
Parameters
layoutBox
The inline layout box containing the words to be merged.
associatedDocumentElement
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
public void MergeTableRowBoxes(TableRowLayoutBox firstRow, TableRowLayoutBox secondRow)
Parameters
firstRow
The first table row layout box to merge.
secondRow
The second table row layout box to merge.
MergeTwoLayoutBoxes(LayoutBox, LayoutBox, bool)
Merges two layout boxes into a single layout box.
Declaration
public void MergeTwoLayoutBoxes(LayoutBox firstBox, LayoutBox secondBox, bool shouldFinalizeRemoval = true)
Parameters
firstBox
The first layout box to be merged.
secondBox
The second layout box to be merged.
shouldFinalizeRemoval
Indicates whether to adjust the layout after merging.
RemoveChild(LayoutBox)
Removes the specified child LayoutBox from the collection.
RemoveLastChild(LayoutBox)
Removes the last child element from the DocumentStructureCollection.
Declaration
public void RemoveLastChild(LayoutBox parent)
Parameters
parent
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
public void RemoveLeafSiblingAfter(LayoutBox layoutBox)
Parameters
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
public static void ReplaceLayoutBox(LayoutBox boxWithNodeToUpdate, SpanLayoutBox newNodeValue)
Parameters
boxWithNodeToUpdate
The layout box that will be replaced.
newNodeValue
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
public void SplitContainer(LayoutBox boxToSplit, LayoutBox fromLayoutBox, LayoutBox newLayoutBox)
Parameters
boxToSplit
The layout box to be split.
fromLayoutBox
The layout box that will represent the first part after the split.
newLayoutBox
The layout box that will represent the second part after the split.
ToString()
Returns a string representation of the DocumentStructureCollection instance.
Declaration
public override string ToString()
Returns
A string that represents the current DocumentStructureCollection object.
Overrides