MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.32k stars 2.45k forks source link

Titlebar Close command does not work with ShowDialogsOverTitleBar=False #2882

Closed magla42 closed 6 years ago

magla42 commented 7 years ago

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

punker76 commented 7 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

thoemmi commented 7 years ago

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 😉

JVimes commented 6 years ago

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.

barishamil commented 6 years ago

I don't want the modal dialog to prevent user from exiting the application in my application so disabling doesn't work for me

JVimes commented 6 years ago

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?

punker76 commented 6 years ago

Finally changes for this issue

The OwnerCanCloseWithDialog is by default false.

The IsCloseButtonEnabledWithDialog is by default true and will be set to false if OwnerCanCloseWithDialog is false.

bradley-dotnet commented 5 years ago

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