Home  separator  Layout  separator  Wrap Panel
Bookmark and Share Share...    Subscribe to this feed Feed   About me...


Wrap Panel

Introduction

The wrap panel is similar to the StackPanel but it does not just stack all child elements to one row, it wraps them to new lines if no space is left. The Orientation can be set to Horizontal or Vertical.

The WrapPanel can be used to arrange tabs of a tab control, menu items in a toolbar or items in an Windows Explorer like list. The WrapPanel is often used with items of the same size, but its not a requirement.

 
<WrapPanel Orientation="Horizontal">
    <Button Content="Button" />
    <Button Content="Button" />
    <Button Content="Button" />
    <Button Content="Button" />
    <Button Content="Button" />
</WrapPanel>
 
 



 Comments on this article

Show all comments
vb guy
Commented on 1.June 2009
This is absolutely the most deatiled example of the Stack Panel I have ever seen! The author took no shortcuts here as all of the WPF StackPanel properties and events are clearly explained alone with Figures for the the more visual people. This link should be the authorative link for everything related to "Stack Panel". Cheers and thanks for the total effort!
thankful...
Commented on 22.June 2009
Vb Guy, if you want to learn more go to the MSDN. This is basic for the WrapPanel, and it's enough for the people who didn't know nothing about that. You must be truly thankful for the effort by the author of this site.
Dantarion
Commented on 23.July 2009
I agree. The fact that this website has pictures and plain-english explanations makes it the best website so far to just read to learn about the different components of WPF.

MSDN is good for API stuff, but for light reading and overviews, its not so great
Joel
Commented on 19.August 2009
In the second paragraph under "Introduction," it begins, "The StackPanel can be used..." -- I think you meant, "The WrapPanel can be used...."
Matt
Commented on 24.September 2009
No Joel, read it again… It makes sense. The paragraph is talking about common uses for each and where you would use a StackPanel as opposed to a WrapPanel.
Betsy
Commented on 22.October 2009
Thanks for the help. What panel would you use to hold images for a photo gallery?
raman
Commented on 28.January 2010
very nice
Me
Commented on 2.March 2010
I agree with VB guy... your just wasting everyones bandwidth.
Nomaan
Commented on 22.April 2010
wow is its a awesome tuturial
sssssss
Commented on 11.May 2010
so so tutorial. not so useful
4545
Commented on 11.May 2010
<WrapPanel Orientation="Horizontal">
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button" />
</WrapPanel>
Prasanta
Commented on 1.June 2010
Nice article.
suma
Commented on 15.June 2010
very nice
sm
Commented on 31.August 2010
nice and light article

Name
E-Mail (optional)
Comment
About Christian Moser