#398 – WrapPanel Element

The WrapPanel element serves as a container for a collection of child elements, positioning its children in one of two ways:

  • In a horizontal orientation (the default).  Child elements are added left to right, until a row fills up, and then wrapped to the next row
  • In a vertical orientation.  Child elements are added top to bottom, until a column fills up, and then wrapped to the next column
    <WrapPanel Orientation="Horizontal">
        <Label Background="AliceBlue" Content="William I" />
        <Label Background="AntiqueWhite" Content="William II"/>
        <!-- etc -->
    </WrapPanel>

    <WrapPanel Orientation="Vertical">
        <Label Background="AliceBlue" Content="William I" />
        <Label Background="AntiqueWhite" Content="William II"/>
        <!-- etc -->
    </WrapPanel>

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

4 Responses to #398 – WrapPanel Element

  1. Pingback: Dew Drop – September 30, 2011 | Alvin Ashcraft's Morning Dew

  2. Pingback: #399 – WrapPanel Will Change Layout of its Children as its Size Changes « 2,000 Things You Should Know About WPF

  3. Brack Bhuvan says:

    Really this is good one. Only to the point nothing else. You made it very simple and understandable which make more user friendly. Some good articles too, I’ve found during searching time over internet which also explained very well about WrapPanel in WPF. Those post URL:
    http://www.c-sharpcorner.com/uploadfile/mahesh/wrappanel-in-wpf/
    and
    http://mindstick.com/Articles/30a24196-28c4-437e-87bc-4c481555bacc/?WrapPanel%20in%20WPF

  4. Pingback: #887 – The Difference between Disabled and Hidden Scrollbar Visibility | 2,000 Things You Should Know About WPF

Leave a comment