Window Size when SizeToContent is not specified

后端 未结 4 1514
借酒劲吻你
借酒劲吻你 2021-01-22 21:23

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



        
4条回答
  •  时光说笑
    2021-01-22 22:01

    I can't find anything in MSDN that explicitly states what the size defaults are, but the Top, Left and WindowStartupLocation property descriptions say that they default to the normal Win32 defaults if not specified. I think it's reasonable to assume that the Height and Width properties would do the same.

    If you don't want this to happen for your window, then you must explicitly set either the Width and Height or the SizeToContent property of the Window element depending on your requirements. The explicit size you set on the Button element will only have an effect on the Window if Window.SizeToContent = True.

提交回复
热议问题