How can I arrange only two items in horizontal in a wrap panel?
I'm using a wrap panel to show several user controls. All of the user controls have a different height and width.
I'd like to a开发者_运维问答rrange the items as maximum 2 items by row, I mean:
| Item1 | Item2 |
| Item3 | Item4 |
| Item5 | Item5 |
I say this becase, when the user expand the window, the items allocate in another positions and it looks like a mess.
Use the UniformGrid
it's made for this very purpose
<UniformGrid Columns="2">
<!-- Your Controls.. -->
</UniformGrid>
Put the WrapPanel in a ListBox, http://msmvps.com/blogs/theproblemsolver/archive/2008/11/18/some-more-fun-with-a-silverlight-listbox.aspx, and then have a MaxWidth.
You could also do your own panel, as here.
精彩评论