Layout Space Adornment in Cider

I have recently been redesigning the architecture used to specify adorner placement within Cider.  This is a good time for us to get to a common understanding of the coordinate systems that affect our adorners in WPF and how they can affect the designer surface.

First, I suggest thinking of render space as a child of layout space. Then the layout moves, the render space moves accordingly.

Next note that render space can move in relation to layout space. This movement can be in any direction and can even place the rendered control outside of the layout space entirely. Render space can also be used to scale and element to be larger or smaller than the layout size of the element.

Consider the following example, the button has been scaled down in size using a RenderTransform with scale dimensions less than 1.0.

Layout properties in WPF such as Margin, Grid.Row, Grid.Column, Width, Height affect the layout space of the element and are relative to the render space of the parent element. So when we talk about the layout space of an element this 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. Grab handles or resize adorners for instance are in layout space since they are directly displaying and affecting the layout. In the example given, the grab handles appear some distance away from the edge of the button because they are not affected by the render transform causing the button to be smaller than the space given to it by the layout properties.

The adorner space is used to define dimensions of the adorner that do not change in size when the designer surface is zoomed.  (Yes, Cider generally supports zooming.  The Cider team has not yet had the time to design the UI and verification tests in order to insure zooming is a high quality experience.)

Most commonly adorner developers are adorning content displayed witin the render space of a control.  Layout space adornments will be needed if you are implmenting a layout tool or custom panel adorners. 

This new design allows adorners to be easily created in the layout space as well as the render space, or the designer view space as before.  Feature designers should consider which space they expect to adorn.  If in doubt, I’d suggest applying a render transform as I did above.  And design your adorners with this distinct difference between the layout space and render space. 

In a later post I will discuss the properties used to position adorners. 

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s