Getting Viewbox and WrapPanel to play nicely together

Hello,

Can anyone tell me how to get a WrapPanel and Viewbox to play nicely together...

Given the following Xaml, how can I get the WrapPanel to utilise more than a single row? Is there anyway I can give the WrapPanel hints about how many rows to use?

<Viewbox>
<
WrapPanel>
<
ButtonContent="Value 1" />
<
ButtonContent="Value 2" />
<
ButtonContent="Value 3" />
<
ButtonContent="Value 4" />
<
ButtonContent="Value 5" />
<
ButtonContent="Value 6" />
<
ButtonContent="Value 7" />
</WrapPanel>
</
Viewbox>

The viewbox works perfectly, sizing the wrappanel into the available space, but the wrappanel puts all the buttons on a single row. I understand this is the expected and correct behaviour, but is there a way I can force the WrapPanel to use more rows?

many thanks

Karl

[3150 byte] By [KarlHulme] at [2007-12-30]
# 1
You can set the WrapPanel's Width to a value which is less than the horizontal space needed to display all of the Buttons. Then the WrapPanel will be forced to use multiple rows.
JoshSmith at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified