wpf 如何从窗口中删除标题栏但保留边框

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

How to remove the title bar from a window but keep the border

wpf

提问by sean717

I tried setting WindowStyle="None"in XAML but that makes the Window completely borderless. I need a Window that does not have a title bar, which prevent user from moving it. But still has border so it still looks like a Window :)

我尝试WindowStyle="None"在 XAML 中进行设置,但这使窗口完全无边界。我需要一个没有标题栏的窗口,这会阻止用户移动它。但仍然有边框,所以它看起来仍然像一个窗口 :)

回答by H.B.

WindowStyle="None"does not remove the border by default, you must allow resizing (ResizeMode= CanResize/ CanResizeWithGrip) and forbid transparency (AllowsTransparency="False") though as far as i know.

WindowStyle="None"默认情况下不会删除边框,但据我所知,您必须允许调整大小 ( ResizeMode= CanResize/ CanResizeWithGrip) 并禁止透明 ( AllowsTransparency="False")。