DocumentWindow and CanClose = false

Docking/MDI for WPF Forum

Posted 9 years ago by FinallyInSeattle
Version: 10.1.0522
Avatar
I have a situation where I need to set CanClose to false on a DocumentWindow. The "X" still displays in the upper right, but it's disabled. Is there some way to hide this? It's very confusing for the user.

Thanks in advance!

Comments (3)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Are you referring to when the DocumentWindow is in a tabbed MDI, standard MDI, a floating window, or all of these locations?


Actipro Software Support

Posted 9 years ago by FinallyInSeattle
Avatar
A standard MDI window.

Thanks for your assistance!
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

One option would be to copy our {x:Static dockingThemes:DockingCommonDictionary.StandardMdiDocumentStyleKey} Style and give it a new key, like "CustomStandardMdiDocumentStyleKey". Then you'd alter the control template by changing the setting of StandardMdiWindowControl.CanClose to be StandardMdiWindowControl.HasCloseButton. So something like this:
<dockingPrimitives:StandardMdiWindowControl x:Name="PART_MagneticWindow"
    ...
    HasCloseButton="{TemplateBinding CanCloseResolved}"
    ... />
Then you'd apply that the "CustomStandardMdiDocumentStyleKey" to the Style property of document windows that you want to hide the close button.

Alternatively, you could create an implicit Style for StandardMdiWindowControl that binds HasCloseButton to a custom attached property on the templated parent (i.e. the DocumentWindow).


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.