Skip to content

Layout Model Control Graph

Dirkster99 edited this page Jun 11, 2019 · 12 revisions

The Home page of this Wiki states that AvalonDock works with a Layout Model Tree (Layout Classes) and a Viaual Tree (Control Classes). This page explains how these trees are created initially (or re-created whenever the DockingManager's LayoutRoot property is changed.

The image below shows 2 trees, a Visual Tree (in Red) and the corresponding Layout Model tree (in Blue). The initial layout model tree can be created in the DockingManager.Layout CoerceLayoutValue() method which is invoked when the Layout dependency property is changed.

initial layout model/control graph

protected virtual void OnLayoutChanged( LayoutRoot oldLayout, LayoutRoot newLayout )

The OnLayoutChanged() method of the DockingManager.Layout dependency property is invoked after the above CoerceLayoutValue() method and creates each corresponding control for a Layout Model by calling the CreateUIElementForModel() method which in turn calls the appropriate control constructor and returns the new control.

LayoutRootPanel = CreateUIElementForModel( Layout.RootPanel ) as LayoutPanelControl;

This means the LayoutPanelControl(LayoutPanel model) constructor is invoked and the model becomes a private member of the control. The creation of the visual tree is continued when the UpdatedChildren() method in the inherited LayoutGridControl<T> class is invoked (eg.: via OnInitialized()). The same mechanism is invoked for the creation of the LayoutDocumentPaneControl since both classes LayoutDocumentPaneGroupControl and LayoutPanelControl are derived from the LayoutGridControl<T> class.

Summary: Layout model to control association is created via parameterized constructors in a given control class. The visual tree is then created when a control is initialized and visual children (with their layout models) are assigned to the Children properties (if the control was derived from Grid or TabItem).

Demo Projects

Controls

Layout Models

Interfaces

Class Designs

Bugs

Manual Tests

Clone this wiki locally