DocumentWindow and CanClose = false

Docking/MDI for WPF Forum

Posted 14 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 14 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 14 years ago by FinallyInSeattle
Avatar
A standard MDI window.

Thanks for your assistance!
Posted 14 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 (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.