Creating a Layout

Creating a layout is a process of positioning and sizing items given a set of constraints. The purpose of the layout is to position the direct children of the view item, and to determine the size of the view item as follows:

The layout is defined per view item by specifying the kind of layout you want. You can use preset layout configurations with a simple inline statement, or you can use the expanded form if you want more control over configuration.

When you do not specify a layout, a default layout is applied. By default, the view item is sized to children, where the overall size is determined by the largest child element. All other children are stacked on top of each other in the same order as they appear in the MCML document (the first child is at the top of the stack, and the last child is at the bottom of the stack.)

MCML layout scales items rather than giving exact positions; everything is relative. Typically, size-to-content options are used, which works well with globalization issues. For example, buttons can adjust in size according to varying sizes of text labels.

When considering layout, think in general terms of where groups of items or containers should be anchored. For example, a title might be anchored to the top right, or a group of icons might be centered horizontally (left to right).

Layout Types and InputsDescribes the preset and custom layouts that are available for displaying children.
Using Fill LayoutDescribes how to use a fill layout.
Using Form and Anchor LayoutsDescribes how to use form and anchor layouts to position children within a parent container.
Using Dock LayoutsDescribes how to use the dock layout to arrange children along parent borders.
Using Vertical and Horizontal Flow LayoutsDescribes how to use vertical and horizontal layouts to position children in a side-by-side layout.
Using Centered LayoutsDescribes how to use a center layout to position children in the center of a parent container.
Using Scale LayoutsDescribes how to use scale layouts to position graphics and specify how they can be scaled.
Using RotateLayoutDescribes how to use rotate layouts to rotate items within a layout.
Using Grid LayoutsDescribes how to use grid layouts to specify rows and columns to display content in a tabular layout.
Setting Minimum and Maximum SizesDescribes how to set sizes on view items for height and width.
Using Margins, Padding, and SpacingDescribes how to set margins and padding to add space around and inside view items.
Using LayersDescribes how to create layers.

See Also