0

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.

Fredrik Hedblad
  • 83,499
  • 23
  • 264
  • 266
Darf
  • 2,495
  • 5
  • 26
  • 37
  • Did you try setting the [`.MaxWidth`](http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.maxwidth.aspx) property? – qJake Aug 26 '11 at 20:06
  • But how MaxWidth can help me? I'll have to get the width user control and multiply for 2. Well, I'm not sure if that is possible – Darf Aug 26 '11 at 20:12

3 Answers3

4

Use the UniformGrid it's made for this very purpose

<UniformGrid Columns="2">
    <!-- Your Controls.. -->
</UniformGrid>
Fredrik Hedblad
  • 83,499
  • 23
  • 264
  • 266
0

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.

patrick
  • 16,091
  • 29
  • 100
  • 164
0

You could also do your own panel, as here.

Marcel
  • 944
  • 2
  • 9
  • 29