开发者

How to remove the System Menu in WPF?

According to this MSDN page, if I were using Window, then I could disable the control box in the top left hand corner by setting it to false. Like this: this.ControlBox = false;

The ControlBox has Maximize, Minimize, Restore and Close options

How to remove the System Menu in WPF?

But since I'm using RibbonWindow instead of Window, how would I disable the control box in this situation?

This question is very related, but I'm looking to disable the SystemMenu all the time, not just to prevent the Alt+Space. This is because (I think) the action listener for the SystemMenu in the top left hand corner blocks a clickable UI element in my XAML.

I should note that this is not a problem with Windows Server 2003, but when the application is opened in Windows 7, the SystemMenu/ControlBox interferes with the UI element in the top left corner.

Additionally, I've found that interfering with the system m开发者_StackOverflowenu usually results in the buttons in the top right hand corner of the application being deactivated, but I don't want that to happen.

Thanks for the link Eammonn. I Think what that person was trying to do is disable the [X] button in the top right hand corner, not the menu in the top left hand corner, but I could be wrong. The reason I don't think it'll work is that they're using <Window x:Class= and I'm using <dc:RibbonWindow x:Class=. Does this make a difference?


The WPF window is not a System.Windows.Forms object, so this.ControlBox = false would not work anyway. There is no explicit property to do this in wpf but see this article

http://winsharp93.wordpress.com/2009/07/21/wpf-hide-the-window-buttons-minimize-restore-and-close-and-the-icon-of-a-window/

It describes how you can remove the WPF version of the control box.

WPF controls are derived from System.Windows.Controls and not System.Windows.Forms


You set your Window's

<Window ...
    WindowStyle="ToolWindow"
    ResizeMode="NoResize">

Good luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜