Cedric
Cedric

Reputation: 1

Autosize and scale WrapPannel

I would like to have a wrap panel (or similar) with a bunch of names scale the text size to

  1. fill all available space (from left to right and top to bottom) the best it can
  2. when i change the size of the window the font size or whatever should increase/decrease, so it always fills the page
  3. the names should all have the same font size

Does anyone have any idea?

I tryed the following but i would manually have to set the size of the wrap pannel so it fits all the text.

<Viewbox x:Name="scaler" Stretch="UniformToFill" Width="{Binding ActualWidth, ElementName=window}">
    <WrapPanel HorizontalAlignment="Left"  x:Name="flpAnwesend" Orientation="Vertical" Height="309" Width="{Binding ActualWidth, ElementName=window}">
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <Label Content="firstname lastname"/>
        <!-- more names-->
    </WrapPanel>
</Viewbox>

EDIT: Here is what it looks like with the first comment. image

And this is what I would like it to look like. (This was done by setting the size of the warplane but I haven’t figured out a good way to do this programmatically) image

Upvotes: 0

Views: 61

Answers (0)

Related Questions