MarkupWrapPanel Object
Description
Wrap Panel Control
For a list of all members defined in this module, see MarkupWrapPanel Members.
Object Model
















Remarks
The Wrap Panel is very similar to the Stack Panel, with the addition that child elements are allowed to wrap to the next row or column.
A Wrap Panel is most useful when needing to display an unknown number of items. The items might or might not be of the same width or height, but it is likely that they would be (Think of Windows Explorer displaying items as icons/large icons). If that is the case, then ItemWidth and ItemHeight can be used to accomplish uniform sizing. The only other option available is the Orientation, which indicates whether the items are displayed vertically or horizontally.
Child elements in the Wrap Panel are positioned sequentially from left to right. Content is broken to the next line when the edge of the containing box is reached.
Wrap panels are very commonly used inside of a ScrollViewer control. This is because it is very likely the items in the Wrap Panel will wrap past the boundaries of the containing control; the ScrollViewer will allow these items to be scrolled to.
Example
The sample below shows a Wrap Panel that contains 20 Button controls and displays them in a ScrollViewer with a maximum width and height of 100 pixels.
<WrapPanel xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
TextElement.FontSize="14"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Margin="5">
<!-- Button controls go here -->
</WrapPanel>
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.