New to Telerik UI for WinForms? Start a free 30-day trial

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:

C#
public abstract class LayoutBox : LayoutElement, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor

Inheritance: objectDisposableObjectRadObjectLayoutElementLayoutBox

Derived Classes: DocumentLayoutBoxFlowOrderedLayoutBoxInlineLayoutBoxParagraphLayoutBoxSectionLayoutBoxTableLayoutBox...

Implements: ICustomTypeDescriptorIDisposableINotifyPropertyChanged

Inherited Members LayoutElement.EnsureChildrenCreated()LayoutElement.CreateChildren()LayoutElement.OnBitStateChanged(DocumentElementStates, bool, bool)LayoutElement.SetBitState(DocumentElementStates, bool)LayoutElement.ValidateParent(LayoutElement)LayoutElement.SetParent(LayoutElement, LayoutElement)LayoutElement.SetParentCore(LayoutElement)LayoutElement.IsInValidState(bool)LayoutElement.OnInvalidateMeasure()LayoutElement.InvalidateMeasure(bool)LayoutElement.InvalidateArrange()LayoutElement.OnInvalidateArrange()LayoutElement.InvalidateArrange(bool)LayoutElement.Arrange(RectangleF)LayoutElement.ArrangeCore(RectangleF)LayoutElement.ArrangeOverride(SizeF)LayoutElement.Measure(SizeF)LayoutElement.MeasureCore(SizeF)LayoutElement.MeasureOverride(SizeF)LayoutElement.OnChildDesiredSizeChanged(LayoutElement)LayoutElement.OnParentChanging()LayoutElement.OnParentChanged()LayoutElement.LayoutOffsetLayoutElement.IsTopContainerLayoutElement.LocalBoundingRectangleLayoutElement.ControlBoundingRectangleLayoutElement.ClippedControlBoundingRectangleLayoutElement.TotalTransformLayoutElement.ChildrenLayoutElement.BitStateLayoutElement.DesiredSizeLayoutElement.IsMeasureInProgressLayoutElement.BypassLayoutPoliciesLayoutElement.MeasureWithoutParentNotificationLayoutElement.SizeLayoutElement.IsArrangeValidLayoutElement.IsMeasureValidLayoutElement.TreeLevelLayoutElement.PreviousArrangeRectLayoutElement.AlignmentLayoutElement.AutoSizeLayoutElement.TransformLayoutElement.ParentChangingLayoutElement.ParentChangedRadObject.BindingContextPropertyRadObject.RadTypeRadObject.ReplaceDefaultDescriptors(PropertyDescriptorCollection)RadObject.DisposeManagedResources()RadObject.ClearPropertyStore()RadObject.SuspendPropertyNotifications()RadObject.ResumePropertyNotifications()RadObject.GetPropertyValue(RadProperty)RadObject.SetDefaultValueOverride(RadProperty, object)RadObject.GetValue(RadProperty)RadObject.SetValue(RadProperty, object)RadObject.ResetValue(RadProperty)RadObject.ResetLocalValue(RadProperty)RadObject.ResetValue(RadProperty, ValueResetFlags)RadObject.UpdateValue(RadProperty)RadObject.GetValueSource(RadProperty)RadObject.GetRegisteredRadProperty(string)RadObject.UpdateValueCore(RadPropertyValue)RadObject.SetValueCore(RadPropertyValue, object, object, ValueSource)RadObject.ResetValueCore(RadPropertyValue, ValueResetFlags)RadObject.GetDefaultValue(RadPropertyValue, object)RadObject.CoerceValue(RadPropertyValue, object)RadObject.ShouldSerializeProperty(RadProperty)RadObject.CanRaisePropertyChangeNotifications(RadPropertyValue)RadObject.BindProperty(RadProperty, RadObject, RadProperty, PropertyBindingOptions)RadObject.UnbindProperty(RadProperty)RadObject.AddStylePropertySetting(IPropertySetting)RadObject.GetInheritedValue(RadProperty)RadObject.OnPropertyChanging(RadPropertyChangingEventArgs)RadObject.OnPropertyChanged(RadPropertyChangedEventArgs)RadObject.OnNotifyPropertyChanged(string)RadObject.OnNotifyPropertyChanged(PropertyChangedEventArgs)RadObject.OnShouldSerializeProperty(ShouldSerializePropertyEventArgs)RadObject.IsPropertyCancelable(RadPropertyMetadata)RadObject.PropertyValuesRadObject.PropertyFilterRadObject.RadObjectTypeRadObject.BindingContextRadObject.PropertyChangedRadObject.RadPropertyChangedRadObject.RadPropertyChangingDisposableObject.GetBitState(long)DisposableObject.SetBitState(long, bool)DisposableObject.OnBitStateChanged(long, bool, bool)DisposableObject.Dispose()DisposableObject.Dispose(bool)DisposableObject.PerformDispose(bool)DisposableObject.DisposeUnmanagedResources()DisposableObject.EventsDisposableObject.IsDisposingDisposableObject.IsDisposedDisposableObject.DisposedDisposableObject.Disposing...

Constructors

Initializes a layout box for a document element and specifies whether it is a fragment.

C#
public LayoutBox(DocumentElement associatedDocumentElement, DocumentStructureCollection collection, bool isFragment)
Parameters:associatedDocumentElementDocumentElement

The document element represented by the box.

collectionDocumentStructureCollection

The document structure collection that owns the box.

isFragmentbool

true when the box is a fragment created by splitting a document element.

Initializes a non-fragment layout box for a document element.

C#
public LayoutBox(DocumentElement associatedDocumentElement, DocumentStructureCollection collection)
Parameters:associatedDocumentElementDocumentElement

The document element represented by the box.

collectionDocumentStructureCollection

The document structure collection that owns the box.

Initializes a non-fragment layout box and creates a document structure collection when no collection is supplied.

C#
public LayoutBox(DocumentElement associatedDocumentElement)
Parameters:associatedDocumentElementDocumentElement

The document element represented by the box.

Fields

Identifies the attached property used to associate a UIElement with its layout box.

C#
public static readonly RadProperty AssociatedLayoutBoxProperty

Tracks the current vertical extent or offset during measurement; it also contributes to vertical-growth checks.

C#
protected float currentY

Gets or sets the node that links this box into the document structure collection.

C#
public BoxNode Node

Properties

Gets the document element represented by this box.

C#
public DocumentElement AssociatedDocumentElement { get; }

Gets this box's axis-aligned bounding rectangle after applying its layout transform.

C#
public RectangleF BoundingRectangle { get; }

Gets whether this box's bounds limit hit-testing and viewport traversal of its child boxes.

C#
public virtual bool BoundsChildBoxes { get; }

Gets whether this box can create layout boxes directly from its content.

C#
protected virtual bool CanCreateLayoutBoxesFromContent { get; }

Gets the index assigned to this box among the children of its parent.

C#
public int ChildIndex { get; }

Gets the child boxes in document order.

C#
public LayoutElementCollection ChildLayoutBoxes { get; }

Gets whether rendering layers include this box when producing document visuals.

C#
public virtual bool HasVisualRepresentation { get; }

Gets whether this box can contain child layout boxes.

C#
public virtual bool IsContainerBox { get; }

Gets whether this is the first layout box representing its associated document element.

C#
public bool IsFirstBox { get; }

Gets whether this is the first child of its parent layout box.

C#
public bool IsFirstChild { get; }

Gets whether this box represents a formatting marker rather than document content.

C#
public virtual bool IsFormattingSymbol { get; }

Gets whether this box represents a fragment of a document element rather than its original, unsplit layout box.

C#
public bool IsFragment { get; }

Gets whether this is the last layout box representing its associated document element on the same tree level.

C#
public virtual bool IsLastBox { get; }

Gets whether this is the last child of its parent layout box.

C#
public bool IsLastChild { get; }

Gets whether this box has been removed from the document layout structure.

C#
public bool IsRemoved { get; }

Gets whether this box can be selected as a document position during navigation.

C#
public virtual bool IsValidPosition { get; }

Gets the parent layout box, resolving a removed parent to its current parent after a merge.

C#
public LayoutBox Parent { get; }

Methods

Checks whether the top container can accommodate the requested height, including growth requested by nested boxes.

C#
protected bool? CanGrowVertically(float desiredHeight)
Parameters:desiredHeightfloat

The height requested by the current box.

Returns:

bool?

The top container's decision, or true when no top container is found.

Determines whether the root layout box can grow to accommodate the requested height. Derived boxes provide the root-level decision.

C#
protected virtual bool? CanGrowVerticallyOverride(float desiredHeight)
Parameters:desiredHeightfloat

The height requested by the layout boxes being measured.

Returns:

bool?

true or false when the root makes a decision; otherwise, null.

Exceptions: NotImplementedException

The 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.

C#
protected override ILinkedListCollection<LayoutElement> CreateChildrenCollection(DocumentStructureCollection collection)
Parameters:collectionDocumentStructureCollectionReturns:

ILinkedListCollection<LayoutElement>

Overrides: LayoutElement.CreateChildrenCollection(DocumentStructureCollection)

Creates a layout element of the concrete type represented by this box and associated with the same document element.

C#
public abstract LayoutElement CreateLayoutElement()
Returns:

LayoutElement

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.

C#
public virtual void CreateNewFragment(LayoutBox currentLineStartNode)
Parameters:currentLineStartNodeLayoutBox

The first box in the new fragment, or null when the split starts at the container boundary.

Exceptions: InvalidOperationException

This box has already been removed from the layout structure.

Gets the layout box associated with a UI element, if one has been assigned.

C#
public static LayoutBox GetAssociatedLayoutBox(UIElement element)
Parameters:elementUIElement

The UI element whose attached layout-box value is retrieved.

Returns:

LayoutBox

The associated layout box, or null when no box is assigned.

Gets the height this box contributes to a vertical-growth request.

C#
protected virtual float GetBoxDesiredGrow()
Returns:

float

Creates a position handler for navigating document positions represented by this box.

C#
public virtual PositionHandler GetPositionHandler()
Returns:

PositionHandler

A position handler for this box.

Gets the document associated with the root document layout box.

C#
public RadDocument GetRootDocument()
Returns:

RadDocument

The root document, or null when the collection has no root box.

Invalidates arrangement for this box and each ancestor up to the root.

C#
public void InvalidateArrangeUpToTheRoot()

Invalidates measurement on the ancestors of this box after a document edit.

C#
public void InvalidateLayoutAfterEdit()

Invalidates measurement for this box and notifies its associated document element.

C#
public override void InvalidateMeasure()

Overrides: LayoutElement.InvalidateMeasure()

Invalidates measurement for this box and each ancestor up to the root. Span boxes also have their text measurement invalidated.

C#
public void InvalidateMeasureUpToTheRoot()

This method currently has no effect.

C#
public void InvalidateMeasureUpToTheRootStable()

Appends the next box's child boxes to this box and invalidates arrangement.

C#
public virtual void MergeWithNext(LayoutBox nextSpanBox)
Parameters:nextSpanBoxLayoutBox

The adjacent box whose children are appended.

Notifies the box that its associated document element has changed.

C#
protected virtual void OnAssociateDocumentElementChanged()

Raises ElementStructureChanged after the represented document structure changes.

C#
protected virtual void OnElementStructureChanged()

Raises ElementStructureChanging before the represented document structure changes.

C#
protected virtual void OnElementStructureChanging()

Associates a layout box with a UI element through AssociatedLayoutBoxProperty.

C#
public static void SetAssociatedLayoutBox(UIElement element, LayoutBox uiElementProvider)
Parameters:elementUIElement

The UI element to associate with the layout box.

uiElementProviderLayoutBox

The layout box to associate with element.

Returns the runtime type name of this layout box.

C#
public override string ToString()
Returns:

string

Overrides: object.ToString()

This method currently does not validate the candidate child box.

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

The child box to validate.

Events

Occurs after the document structure represented by this box changes.

C#
public event EventHandler ElementStructureChanged

Occurs before the document structure represented by this box changes.

C#
public event EventHandler ElementStructureChanging

Extension Methods