Skip to content

MarkupWrapPanel Object

Description

Wrap Panel Control

For a list of all members defined in this module, see MarkupWrapPanel Members.

Object Model

MarkupWrapPanel Object Model
Render Transform
Margin
Background
Mouse Leave Event
Mouse Enter Event
Mouse Left Button Up Event
Mouse Left Button Down Event
Mouse Right Button Up Event
Mouse Right Button Down Event
Mouse Move Event
Lost Mouse Capture Event
Find Name
Visual Parent
Children
Markup UI Element

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

MarkupWrapPanel Members


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.