Darf
Darf

Reputation: 2585

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 arrange 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.

Upvotes: 0

Views: 301

Answers (3)

Fredrik Hedblad
Fredrik Hedblad

Reputation: 84657

Use the UniformGrid it's made for this very purpose

<UniformGrid Columns="2">
    <!-- Your Controls.. -->
</UniformGrid>

Upvotes: 4

Marcel
Marcel

Reputation: 974

You could also do your own panel, as here.

Upvotes: 0

patrick
patrick

Reputation: 16949

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.

Upvotes: 0

Related Questions