Layout Space and Render Space

In the Windows Presentation Foundation (WPF) Designer for Visual Studio, you can place controls on the design surface relative to two different reference frames: layout space and render space.

Layout space defines how much space the control occupies when the layout of your design is calculated by the WPF layout system. You can see the layout space of a control easily in the WPF Designer, because the layout space is adorned by selection adorners when you select a control.

Render space defines how much space a control occupies after the layout is calculated and all render transforms are applied.

Parent-child Relationship

By default, the render and layout spaces for a control are contiguous, which means they occupy the same space. You can move render space in relation to layout space by using render transforms. This movement can be in any direction and can even place the rendered control outside of the layout space entirely. Render transforms can also be used to scale an element to be larger or smaller than the layout size of the element. For more information on render transforms, see Transformations.

In the following example, the button has been reduced in size by using a RenderTransform with scale dimensions less than 1.0.

A button scaled to be smaller than its layout size

Layout properties such as Margin, Grid.Row, Grid.Column, Width, and Height affect the layout space of the element and are relative to the render space of the parent element. The layout space of an element maps to the render space of the element’s parent.

Any adorners which interact with these layout properties must also be placed in the layout space. For example, grab handles or resize adorners are in layout space, because they directly display and affect the layout. In the previous example, the grab handles appear some distance away from the edge of the button because they are not affected by the render transform. This causes the button to be smaller than the space given to it by the layout properties.

See Also

Concepts

Adorner Architecture

Reference

AdornerPanel

Other Resources

WPF Designer Extensibility