Mahapps.metro: Titlebar Close command does not work with ShowDialogsOverTitleBar=False

Created on 7 Mar 2017  路  7Comments  路  Source: MahApps/MahApps.Metro

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:

  • Uncheck the DialogsShow Dialogs Over TitleBar - item
  • Open a dialog, e.g., DialogsShow InputDialog (just because it's the top one)
  • Click the Close button (X) in the title bar, as well as right click the title bar and choose Close.

Environment

  • MahApps.Metro 1.4.3
  • Windows OS 10
  • Visual Studio 2015
  • .NET Framework 4.6
Feature Request

Most helpful comment

@magla42 this was introduced by https://github.com/MahApps/MahApps.Metro/issues/2409
maybe we can allow this if ShowDialogsOverTitleBar=False /cc @thoemmi

All 7 comments

@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

  • New OwnerCanCloseWithDialog property at MetroDialogSettings which can be used to handle how the owner of the dialog can be closed.
  • New 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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oschwab picture oschwab  路  17Comments

feinstein picture feinstein  路  18Comments

ghiboz picture ghiboz  路  11Comments

seb30 picture seb30  路  12Comments

AndrzejKl picture AndrzejKl  路  12Comments