Partager via


Other layout containers

In addition to the five primary layout panels (Canvas, DockPanel, Grid, StackPanel, and WrapPanel), there are other layout elements that have an effect on how the objects that they contain are arranged. These layout panels, while useful in certain scenarios, are not optimized to support the more robust user interface (UI) scenarios that the primary layout panels are designed to handle elegantly. You can add these other layout panels to your project by using the Assets panel or the layout container button in the Tools panel.

For more information about these layout containers, see the .NET Development section of the Windows Software Development Kit (SDK).

Border

A Border object is a simple object that draws a border, background, or both around another object. The Border object takes only one child object. You'll likely want to place a Grid panel or Canvas panel within a Border object so that you can work with multiple child objects.

A Border object

JJ171002.e761238b-99fd-43c5-bbc4-57538b8289ff(fr-fr,VS.110).png

BulletDecorator (WPF only)

A BulletDecorator object is an object that can only take two child objects, which are typically a text string and a glyph (which represents a control such as a check box).

A BulletDecorator object

JJ171002.8a08a515-b6dc-4e03-948f-1427dd7bab72(fr-fr,VS.110).png

A Popup object (available in the Assets panel) is a window that renders in front of all other content in an application but relative to another object. For example, you can use a pop-up as a context menu for an object to provide additional information and options to users. The Popup object takes a single child object and is positioned based on a target object. By default, a Popup object has a Grid panel as its single child object. You can use the Grid panel to work with multiple child objects inside the Popup object. In most cases, you will not have to directly create a pop-up yourself because you can instead use a control, such as a menu or combo box, that uses a pop-up in its template. A Popup object has a Placement property that you can set in the Properties panel under Layout. The Placement property determines where the pop-up appears relative to the object used to invoke the pop-up.

ScrollViewer

A ScrollViewer object enables scrolling of the child objects that it contains. It takes only a single child object, so in most cases you will want to use a layout panel such as a StackPanel panel, Canvas panel, or Grid panel inside it. Each time you add a child object to a ScrollViewer object, the new child object will overwrite the existing child object. The ScrollViewer object is used within the templates of other controls, such as list boxes, to support the scrolling of content. When the content inside a ScrollViewer object is too large, you can enable the content to be clipped. You can also control whether scroll bars are disabled, hidden, visible, or automatically shown only when needed.

A ScrollViewer object

JJ171002.06b326d4-f23d-41a6-b26b-e1aff37572a7(fr-fr,VS.110).png

UniformGrid (WPF only)

A UniformGrid object arranges child objects within equal, or uniform, Grid regions. The UniformGrid object is not a variation of the Grid panel; it can be more accurately described as a tiling layout object because it creates equal spacing among the objects that it contains, based on the number of rows and columns you specify. You can specify the number of rows and columns under Common Properties in the Properties panel. As you add child objects to a UniformGrid object, each object is placed in a region starting from upper left to lower right until the UniformGrid is filled. This is useful for a control such as an image list.

A UniformGrid object

JJ171002.928b9284-a7e8-4678-875a-656b80b78076(fr-fr,VS.110).png

Viewbox (WPF only)

A Viewbox object scales all its child objects similarly to how a a zoom control would. Because a Viewbox object takes only a single child object, you typically place a Canvas panel or Grid panel inside it so that you can take advantage of the zoom effect on more than one child object.

The Viewbox object, scaled to display different views of the same object or set of objects, such as zoomed in, zoomed out, or mirrored view

JJ171002.f5b13c66-d918-4141-8a16-bd8f8628687a(fr-fr,VS.110).png