最大化WPF窗口 [英] Maximize the WPF window

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

问题描述

你好,
我是WPF应用程序开发的新手,开发的第一天就遇到了一个问题,问题是我的表单仅在水平方向最大化,而不在垂直方向最大化,我已经尽力了,但是仍然没有任何进展.有人可以帮我解决这里的问题吗?

以下是我正在尝试以编程方式实现的目标. (显然是单击最大化按钮)
(mw是"MainWindow"的名称.).

Hello,
I am new to WPF Application development and got a problem right on the first day of development, the problem is that my form is maximizing only horizontally and not vertically, i''ve tried what i knew but still there is no progress. Can anyone help me with a work around here?

Below is the thing that i am trying to achieve programmatically. (Obviously on click of maximize button)
(mw is the name of "MainWindow").

mw.WindowState = WindowState.Maximized;



我已经尝试过此行下的代码,但没有任何进展



i''ve tried the code below this line but no progress

mw.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;

推荐答案

在您的xaml.
这样可以使您在垂直方向上最大化到最大高度.
Set the Height of the window to Auto in your xaml.
That should allow you to maximize to full height vertically.


这篇关于最大化WPF窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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