wpf 如何从 MahApps.Metro 模板中删除窗口命令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21367212/
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-13 10:36:52  来源:igfitidea点击:

How to remove the Window Commands From MahApps.Metro Template?

c#wpfmahapps.metro

提问by Antisan

Metro template for WPF app. I want a Window which dont have any Window Command like minimize maximize and close. In normal WPf it can be done by WindowsStyle but how i can remove them in this template. And i also want to make the Window to be TopMost="True" and WindowState="Maximized". So all this settings are possible in this template ? Please advice ?

WPF 应用程序的 Metro 模板。我想要一个没有任何窗口命令的窗口,例如最小化最大化和关闭。在普通的 WPf 中,它可以通过 WindowsStyle 完成,但我如何在此模板中删除它们。而且我还想让 Window 成为 TopMost="True" 和 WindowState="Maximized"。那么所有这些设置都可以在这个模板中实现吗?请指教 ?

回答by Aleksandar Toplek

No need to thange templates, just set some properties.

无需感谢模板,只需设置一些属性即可。

MetroWindow has properties:

MetroWindow 具有以下属性:

<controls:MetroWindow ...

    Topmost="True" 
    WindowState="Maximized"

    ShowTitleBar="False" // Hide colored tile bar, title header and icon

    ShowCloseButton="False" 
    ShowMaxRestoreButton="False" 
    ShowMinButton="False"

    ShowWindowCommandsOnTop="False" // No window commands on top of flyouts

which will remove title bar (icon+color), and you can remove buttons too.

这将删除标题栏(图标+颜色),您也可以删除按钮。