如果没有指定SizeToContent的窗口大小 [英] Window Size when SizeToContent is not specified

查看:1010
本文介绍了如果没有指定SizeToContent的窗口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用下面的XAML,窗口大小不是5000x5000,但一些小窗口,在这里被裁剪的按钮。

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>

这是我可以告诉,大小我没有指定SizeToContent属性,默认为手动,所以它会使用的 *一个窗口的大小是由其它属性,包括宽度,高度,了maxWidth,了maxHeight,了minWidth,并确定了minHeight。 * WPF的Windows概述,似乎与其他属性是FrameworkElement的::了minHeight /宽度和FrameworkElement的::了maxHeight。但由于默认为敏思是0,则MAXS是无限与宽/高是南....这是怎么回事?哪里是WPF得到窗口的大小?

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?

任何指针朝着正确的方向将是AP preciated。

Any pointers to the right direction would be appreciated.

推荐答案

如果宽度和高度没有指定WPF使用60%的你的宽度主屏幕(其中实际显示的视窗)和其高度的60%的。这是由应用程序单,其中最终所有的Windows注册themselfes完成。

If the width and height are not specified WPF uses 60% of the width of you primary screen (where the windows is actually displayed) and 60% of its height. This is done by the Application singleton where all Windows ultimately register themselfes.

这篇关于如果没有指定SizeToContent的窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆