LayoutBox
Represents a document element in the layout tree, including fragments created when the element is split across layout containers.
Definition
Namespace:Telerik.WinForms.Documents.Layout
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public abstract class LayoutBox : LayoutElement, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor
Inheritance: objectDisposableObjectRadObjectLayoutElementLayoutBox
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes a layout box for a document element and specifies whether it is a fragment.
public LayoutBox(DocumentElement associatedDocumentElement, DocumentStructureCollection collection, bool isFragment)
The document element represented by the box.
collectionDocumentStructureCollectionThe document structure collection that owns the box.
isFragmentbooltrue when the box is a fragment created by splitting a document element.
Initializes a non-fragment layout box for a document element.
public LayoutBox(DocumentElement associatedDocumentElement, DocumentStructureCollection collection)
The document element represented by the box.
collectionDocumentStructureCollectionThe document structure collection that owns the box.
Initializes a non-fragment layout box and creates a document structure collection when no collection is supplied.
public LayoutBox(DocumentElement associatedDocumentElement)
The document element represented by the box.
Fields
Identifies the attached property used to associate a UIElement with its layout box.
public static readonly RadProperty AssociatedLayoutBoxProperty
Tracks the current vertical extent or offset during measurement; it also contributes to vertical-growth checks.
protected float currentY
Properties
Gets the document element represented by this box.
public DocumentElement AssociatedDocumentElement { get; }
Gets this box's axis-aligned bounding rectangle after applying its layout transform.
public RectangleF BoundingRectangle { get; }
Gets whether this box's bounds limit hit-testing and viewport traversal of its child boxes.
public virtual bool BoundsChildBoxes { get; }
Gets whether this box can create layout boxes directly from its content.
protected virtual bool CanCreateLayoutBoxesFromContent { get; }
Gets the index assigned to this box among the children of its parent.
public int ChildIndex { get; }
Gets the child boxes in document order.
public LayoutElementCollection ChildLayoutBoxes { get; }
Gets whether rendering layers include this box when producing document visuals.
public virtual bool HasVisualRepresentation { get; }
Gets whether this box can contain child layout boxes.
public virtual bool IsContainerBox { get; }
Gets whether this is the first layout box representing its associated document element.
public bool IsFirstBox { get; }
Gets whether this is the first child of its parent layout box.
public bool IsFirstChild { get; }
Gets whether this box represents a formatting marker rather than document content.
public virtual bool IsFormattingSymbol { get; }
Gets whether this box represents a fragment of a document element rather than its original, unsplit layout box.
public bool IsFragment { get; }
Gets whether this is the last layout box representing its associated document element on the same tree level.
public virtual bool IsLastBox { get; }
Gets whether this is the last child of its parent layout box.
public bool IsLastChild { get; }
Gets whether this box has been removed from the document layout structure.
public bool IsRemoved { get; }
Gets whether this box can be selected as a document position during navigation.
public virtual bool IsValidPosition { get; }
Methods
Checks whether the top container can accommodate the requested height, including growth requested by nested boxes.
Determines whether the root layout box can grow to accommodate the requested height. Derived boxes provide the root-level decision.
protected virtual bool? CanGrowVerticallyOverride(float desiredHeight)
The height requested by the layout boxes being measured.
Returns:bool?
true or false when the root makes a decision; otherwise, null.
Exceptions: NotImplementedExceptionThe root box does not implement the vertical growth check.
Creates an empty child collection for leaf boxes and a document-structure-backed collection for other boxes.
protected override ILinkedListCollection<LayoutElement> CreateChildrenCollection(DocumentStructureCollection collection)
Overrides:
Creates a layout element of the concrete type represented by this box and associated with the same document element.
public abstract LayoutElement CreateLayoutElement()
A new layout element matching this box's concrete type.
Splits this box and the relevant ancestor containers to create layout fragments at a line boundary.
public virtual void CreateNewFragment(LayoutBox currentLineStartNode)
The first box in the new fragment, or null when the split starts at the container boundary.
Exceptions: InvalidOperationExceptionThis box has already been removed from the layout structure.
Gets the layout box associated with a UI element, if one has been assigned.
Gets the height this box contributes to a vertical-growth request.
Creates a position handler for navigating document positions represented by this box.
public virtual PositionHandler GetPositionHandler()
A position handler for this box.
Gets the document associated with the root document layout box.
public RadDocument GetRootDocument()
The root document, or null when the collection has no root box.
Invalidates arrangement for this box and each ancestor up to the root.
public void InvalidateArrangeUpToTheRoot()
Invalidates measurement on the ancestors of this box after a document edit.
public void InvalidateLayoutAfterEdit()
Invalidates measurement for this box and notifies its associated document element.
public override void InvalidateMeasure()
Overrides:
Invalidates measurement for this box and each ancestor up to the root. Span boxes also have their text measurement invalidated.
public void InvalidateMeasureUpToTheRoot()
This method currently has no effect.
public void InvalidateMeasureUpToTheRootStable()
Appends the next box's child boxes to this box and invalidates arrangement.
public virtual void MergeWithNext(LayoutBox nextSpanBox)
The adjacent box whose children are appended.
Notifies the box that its associated document element has changed.
protected virtual void OnAssociateDocumentElementChanged()
Raises ElementStructureChanged after the represented document structure changes.
protected virtual void OnElementStructureChanged()
Raises ElementStructureChanging before the represented document structure changes.
protected virtual void OnElementStructureChanging()
Associates a layout box with a UI element through AssociatedLayoutBoxProperty.
Returns the runtime type name of this layout box.
This method currently does not validate the candidate child box.
Events
Occurs after the document structure represented by this box changes.
public event EventHandler ElementStructureChanged
Occurs before the document structure represented by this box changes.
public event EventHandler ElementStructureChanging