How to find out minimal render size of a visual in WPF?

Posted by MartyIX on Stack Overflow See other posts from Stack Overflow or by MartyIX
Published on 2010-04-08T19:16:06Z Indexed on 2010/04/08 21:53 UTC
Read the original article Hit count: 313

Filed under:
|
|
|

Hello,

I'm trying to display a game desk and info panel right next to the game desk and I need to calculate minimal width of the info panel in order to display the game desk properly.

This is my XAML code:

<StackPanel Orientation="Horizontal">
    <Rectangle Width="Auto" Height="Auto" Name="gamedeskRect" Style="{DynamicResource GameDesk}" />
    <StackPanel Name="infoPanel" Width="Auto" HorizontalAlignment="Right" Height="Auto"  VerticalAlignment="Center" Margin="10,0,0,0">
    <!-- a few textblocks in a grid here -->
    </StackPanel>
</StackPanel>

And the problem is that when I'm resizing the window a part of the right panel may be cropped which is what I don't want.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about size