Compartilhar via


Stack panel

This page applies to WPF and Silverlight 2

A stack panel allows you to stack elements in an assigned direction. Based on the properties that you define within a stack panel, content can flow both vertically (by default) and horizontally. A stack panel is predominantly used within list controls, such as within a list box or within the pop-up list in a combo box. Any element that you create or draw within a stack panel will be added automatically as the last child element in the stacking order of the elements in the panel. As you add more child elements, you will see that the stack panel will clip (or hide) those elements that do not fit.

  • **Orientation  ** By default, the elements within a stack panel are stacked vertically, but you can also stack them horizontally.

  • **Nested Panels  ** You can use a nested layout panel (in other words, you can use a layout panel as a child element) to contain the side-by-side elements. The nested panel stacks in exactly the same way as any other child element contained within the parent stack panel.

Add a stack panel to a document using the Asset LibraryCc294551.0224cabd-5da1-4e01-bddd-4a647401a098(en-us,Expression.10).png or the layout container button in the Toolbox. For more about working with stack panels, see the related topics, Change the stacking order order and Change the stack orientation.

Objects in a stack panel set to vertical orientation

Cc294551.a85a7b57-b0a8-495e-b985-f0291e41d093(en-us,Expression.10).png