LayoutElement
Base class for elements measured and arranged by the document layout system.
Definition
Namespace:Telerik.WinForms.Documents.Layout
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public abstract class LayoutElement : RadObject, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor
Inheritance: objectDisposableObjectRadObjectLayoutElement
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes the element in the specified document structure collection.
public LayoutElement(DocumentStructureCollection collection)
The collection that owns the element, or null to create a collection rooted at this element.
Properties
Gets or sets how the base arrangement policy aligns the arranged size within the available final rectangle.
public ContentAlignment Alignment { get; set; }
Gets or sets a value indicating whether the element size will be calculated automatically by the layout system. Value of false indicates that the element's size will not be changed when calculating the layout.
public virtual bool AutoSize { get; }
Gets the bit-vector storage for this element's layout state flags.
protected DocumentElementStateBitVector BitState { get; }
Gets or sets whether measurement and arrangement bypass the base layout policies and use the override results directly.
public bool BypassLayoutPolicies { get; set; }
Gets this element's child collection, creating it on first access.
public ILinkedListCollection<LayoutElement> Children { get; }
Gets the control bounding rectangle clipped by ancestors that clip their children.
public virtual RectangleF ClippedControlBoundingRectangle { get; }
Gets the axis-aligned bounding rectangle of this element after applying its complete layout transform.
public virtual RectangleF ControlBoundingRectangle { get; }
Gets or sets the size calculated by the most recent measurement, or explicitly supplied by the layout owner.
public SizeF DesiredSize { get; set; }
Gets whether the most recent arrangement is still valid.
public bool IsArrangeValid { get; }
Gets whether this element is currently executing its measure pass.
public bool IsMeasureInProgress { get; }
Gets whether the most recent measurement is still valid.
public bool IsMeasureValid { get; }
Gets whether this element is a top-level container whose layout policy can govern vertical growth.
public virtual bool IsTopContainer { get; }
Gets the element's offset from its parent's origin after arrangement.
public PointF LayoutOffset { get; }
Gets the element's untransformed bounds in its parent's coordinate space.
public RectangleF LocalBoundingRectangle { get; }
Gets or sets the measure-without-parent-notification state flag. The base layout implementation stores this flag but does not otherwise act on it.
public bool MeasureWithoutParentNotification { get; set; }
Gets the parent element in the layout tree, or null for the root.
public LayoutElement Parent { get; }
Gets the rectangle supplied to the most recent arrangement pass.
public RectangleF PreviousArrangeRect { get; }
Gets or sets the size of the element which is the height and width of the visual rectangle that would contain the element. Size corresponds to element's Bounds.Size. When the AutoSize property is set to true setting the Size property to some value has no effect.
public SizeF Size { get; set; }
Gets the transform formed by composing this element's transform with its ancestors' transforms.
public RadMatrix TotalTransform { get; }
Gets the element's transform, including its arranged offset as translation.
public RadMatrix Transform { get; }
Methods
Arranges the element within the supplied rectangle, measuring first if its measure data is invalid.
public void Arrange(RectangleF finalRect)
The element's available final rectangle in its parent's coordinate space.
Exceptions: InvalidOperationExceptionThe rectangle has a NaN or positive-infinite width or height.
Applies the base layout policy and delegates element-specific positioning to ArrangeOverride(SizeF).
protected virtual void ArrangeCore(RectangleF finalRect)
The rectangle assigned to this element by its parent.
Arranges the LayoutElement to its final location. The element must call the Arrange method of each of its children.
protected virtual SizeF ArrangeOverride(SizeF finalSize)
The size that is available for element.
Returns:The rectangle occupied by the element. Usually finalSize. Should you return different size, the Layout system will restart measuring and rearranging the items. That could lead to infinite recursion.
In this method call to the Arrange method of each child must be made.
Creates the child collection for this element.
protected virtual ILinkedListCollection<LayoutElement> CreateChildren()
Creates the collection used to store this element's children.
protected virtual ILinkedListCollection<LayoutElement> CreateChildrenCollection(DocumentStructureCollection collection)
The document structure collection that owns the element.
Returns:ILinkedListCollection<LayoutElement>
A collection backed by the document structure tree.
Creates the child collection the first time it is needed.
protected void EnsureChildrenCreated()
Marks this element's arrangement as invalid and invokes the invalidation hook.
public void InvalidateArrange()
Marks this element's measure data as invalid and invokes the invalidation hook.
public virtual void InvalidateMeasure()
Determines whether the element is in a state that permits layout work.
This implementation always returns true and ignores checkElementTree.
Measures the element for the available size and updates DesiredSize. Reuses the previous result when the constraint is unchanged and measurement remains valid.
public void Measure(SizeF availableSize)
The available size; either dimension may be positive infinity.
Exceptions: InvalidOperationExceptionThe available size contains NaN, or the measure override returns NaN or positive infinity.
Applies the base measurement policies and delegates element-specific measurement to MeasureOverride(SizeF).
Measures the space required by the LayoutElement Used by the layout system.
protected virtual SizeF MeasureOverride(SizeF availableSize)
The size that is available to the LayoutElement. The available size can be infinity (to take the full size of the element)
Returns:The minimum size required by the element to be completely visible. Cannot be infinity.
In this method call to the Measure method of each child must be made.
Notifies the object for a change in its bit state.
protected virtual void OnBitStateChanged(DocumentElementStates key, bool oldValue, bool newValue)
The DocumentElementStates key.
oldValueboolThe old value.
newValueboolThe new value.
Responds when a child's desired size changes. The base implementation invalidates this element's measure when its measure is valid, it is auto-sized, and it is not a clone.
protected virtual void OnChildDesiredSizeChanged(LayoutElement child)
The child whose desired size changed.
Provides a notification hook after this element's arrangement is invalidated.
protected virtual void OnInvalidateArrange()
Provides a notification hook after this element's measurement is invalidated.
protected virtual void OnInvalidateMeasure()
Raises ParentChanged after the parent reference changes.
protected virtual void OnParentChanged()
Raises ParentChanging before the parent reference changes.
protected virtual void OnParentChanging()
Applies the specified boolean value to the BitVector of the object.
protected virtual void SetBitState(DocumentElementStates key, bool value)
The DocumentElementStates key.
valueboolThe value.
Updates the parent layout element and raises the parent-change notifications.
protected virtual void SetParent(LayoutElement oldParent, LayoutElement newParent)
The current parent before the change.
newParentLayoutElementThe parent to assign, or null to detach this element.
Changes the parent reference, raising ParentChanging before assignment and ParentChanged afterward.
protected void SetParentCore(LayoutElement newParent)
The parent to assign, or null to detach this element.
Validates whether the specified element can be assigned as this element's parent. This check is called by the parent-assignment path in debug builds.
protected virtual void ValidateParent(LayoutElement newParent)
The proposed parent, or null when detaching this element.
Exceptions: InvalidOperationExceptionThe parent type is not supported for this layout element.
Events
Occurs immediately after this element's parent reference changes.
public event EventHandler ParentChanged
Occurs immediately before this element's parent reference changes.
public event EventHandler ParentChanging