阻止用户调整用 WPF 编写的应用程序的顶级窗口大小的最佳方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/278304/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:46:23  来源:igfitidea点击:

What is the best way to stop a user from resizing the top-level window of an application written in WPF?

wpfresizesize

提问by Thomas Bratt

What is the best way to stop a user from resizing the top-level window of an application written in WPF?

阻止用户调整用 WPF 编写的应用程序的顶级窗口大小的最佳方法是什么?

回答by Todd White

You will want to use the ResizeMode.NoResizeon the window.

您将要使用ResizeMode.NoResize窗口上的 。

<Window x:Class="WpfApplication5.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    ResizeMode="NoResize">
</Window>

回答by Rob Sobers

A WPF quirk to note is that if ResizeMode="NoResize"and WindowStyle="None"you will lose the chrome around the entirelyin Vista Aero.

一个WPF怪癖要注意的是,如果ResizeMode="NoResize"WindowStyle="None"你将失去的镀铬绕完全在Vista的Aero。