Closed magla42 closed 6 years ago
@magla42 this was introduced by https://github.com/MahApps/MahApps.Metro/issues/2409
maybe we can allow this if ShowDialogsOverTitleBar=False
/cc @thoemmi
I agree. Either the Close button is enabled and working, or disabled if it's not allowed.
Ideally there would be an option in MetroDialogSettings
, if the Close button should be enabled or not 😉
Disabling the close button would be a step in the right direction. Non-modal dialogs can allow it, but I don't know if there's a way to specify non-modal.
I don't want the modal dialog to prevent user from exiting the application in my application so disabling doesn't work for me
If close is allowed, then it's not strictly modal, I think. But we need that ability, too. We could add a Modal="true/false"
setting. Maybe even make false the default. When true, close is either disabled, or closes the modal dialog. Thoughts?
Finally changes for this issue
OwnerCanCloseWithDialog
property at MetroDialogSettings
which can be used to handle how the owner of the dialog can be closed.IsCloseButtonEnabledWithDialog
property at MetroWindow
which indicates if the close button should be enabled or not if a dialog is shown.The OwnerCanCloseWithDialog
is by default false.
The IsCloseButtonEnabledWithDialog
is by default true and will be set to false if OwnerCanCloseWithDialog
is false.
In 1.6.5 this behavior seems to be broken again. The Closing
event still fires on the window, and you can call Application.Current.Shutdown()
to get around it.
Note that OwnerCasCloseWithDialog
is set to true, as is IsCloseButtonEnabledWithDialog
What steps will reproduce this issue?
With the MetroWindow.ShowDialogsOverTitlebar flag set to False, the title bar Close button, as well as the Close menu item in the title bar context menu does nothing when a dialog is open. Minimize, Maximize, Move, Size etc works fine.
Expected outcome
I am not entirely sure what the desired behavior would be, but it should either work, i.e., close the window, or the Close button and Close menu item should be disabled when a dialog is open.
Repo
In the MahApps.Metro.Demo.NET45 application:
Environment