17

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
I want to disable this box in my own application

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 menu 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?

Community
  • 1
  • 1
Jeffrey Greenham
  • 1,382
  • 5
  • 16
  • 33
  • 1
    Where does RibbonWindow come from (I know at least 2 different libraries that provide this, just wondering which one you're using). – CodingGorilla Mar 11 '11 at 17:55
  • Microsoft.Windows.Control.Ribbon.RibbonWindow – Jeffrey Greenham Mar 11 '11 at 17:58
  • 1
    Eamonn's answer should work for the RibbonWindow as well, as it is just an extension of Window. Office 2010 re-introduced the control box (with the icon). Office 2007 had hidden it, in favor of the orb. Is this interfering with the orb or the quick access toolbar? – CodeNaked Mar 14 '11 at 02:16
  • Yes, I believe so. The problem is that when the user clicks on the orb at a certain place, the quick access toolbar comes up. – Jeffrey Greenham Mar 14 '11 at 17:07

2 Answers2

15

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

Eamonn McEvoy
  • 8,876
  • 14
  • 53
  • 83
3

You set your Window's

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

Good luck.