0

I'm trying to make a usercontrol that works across a variety of widths. One strand of this goal is to responsively switch from two columns to one as the width is reduced. A WrapPanel allows this easily.

One problem with the WrapPanel though, is that I now have no way to specify that each of the columns should (when displayed side-by-side) each take up 50% of the available width. If I were using a Grid, I could specify that each column should have a width of "1*" - how can I achieve the same result without sacrificing the responsiveness of WrapPanel?

(This question appears similar, but I tried the approach without success. I think it refers specifically to WrapPanels as children rather than parent elements.)

Community
  • 1
  • 1
Tom Wright
  • 11,278
  • 15
  • 74
  • 148
  • Does your program decide when to switch from e.g. 3 to 2 columns based on some total width, or should the switch happen automatically based on how wide each item is? – Sphinxxx Jan 24 '14 at 17:33
  • Ideally the switch would be automatic, like the `WrapPanel` does. – Tom Wright Jan 27 '14 at 14:23
  • Ok, that would be the more difficult option, especially since you want your items to take up all the available width. However, if you could find a way to let your program decide when to switch the number of columns, you'll get the behavior you want quite easily using a `UniformGrid` and adjusting its `Columns` property. – Sphinxxx Jan 27 '14 at 20:56
  • Very late to the party, but check the accepted answer to [this question](https://stackoverflow.com/questions/23524453/wrappanel-trying-to-make-the-itemwidth-equal-to-the-max-width-of-any-one-elemen?noredirect=1&lq=1) – mcalex Mar 23 '20 at 08:28

0 Answers0