Window Size when SizeToContent is not specified

Posted by moogs on Stack Overflow See other posts from Stack Overflow or by moogs
Published on 2009-09-17T06:47:57Z Indexed on 2010/04/03 14:03 UTC
Read the original article Hit count: 332

Filed under:
|
|

When the following XAML used, the window size is not 5000x5000, but some small window where the button is cropped.

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" >
    <Button Width="5000" Height="5000">XXX</Button>
</Window>

From what I can tell, size I did not specify the SizeToContent attribute, the default is "Manual", so it will use *size of a window is determined by other properties, including Width, Height, MaxWidth, MaxHeight, MinWidth, and MinHeight. * From the WPF Windows Overview, it seems those other properties are FrameworkElement::MinHeight/Width, and FrameworkElement::MaxHeight. But since the default for the Mins are 0, the Maxs are Infinity and the Width/Height is Nan....what's going on? Where is WPF getting the window size?

Any pointers to the right direction would be appreciated.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about .NET