Share via


That's a WrapPanel and I am outta here... [A balanced WrapPanel implementation for Silverlight and WPF!]

**

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments

  • Anonymous
    November 25, 2010
    I was expecting a balanced Wrap Panel that would make columns or rows equally long (depending on the orientation). In your example you have 15 elements in your wrap panel. This would result in 3 rows or 3 columns of 5 items each. Would that kind of balancing be just as easy to implement?

  • Anonymous
    November 26, 2010
    Torsten, That seems like it would be fairly straightforward. In fact, I bet you could use my BandedStackPanel to do exactly that: blogs.msdn.com/.../this-one-time-at-band-camp-a-banded-stackpanel-implementation-for-silverlight-and-wpf.aspx Hope this helps!

  • Anonymous
    July 24, 2012
    Hi, this is great stuff. I have a query though, the post is pretty old but hoping for the best.. I'm using this as ItemsPanelTemplate of a listbox. I need to make changes to this so that the items in the panel increase/decrease their size a little to use up all the slack space. I tried to change the values that go into the element.Arrange() call but that changes the ListBoxItem's size, but not the size of the control sitting as the item. My listbox has a button in the ItemTemplate. Any suggestions on what I should do? Thanks

  • Anonymous
    July 24, 2012
    Ronnie, I think what you want is to set ListBox.ItemContainerStyle to a Style/TargetType=ListBoxItem with a Setter/HorizontalContentAlignment=Stretch. That'll tell the ListBoxItem wrapper to stretch its content which it sounds like it isn't doing at the moment.

  • Anonymous
    February 26, 2014
    I'm late for the party but just want to say this is good stuff! :)