From 8c963ec8e2505255afea3f46b237d9278870c36f Mon Sep 17 00:00:00 2001 From: Sunyunpeng Date: Mon, 15 Jul 2019 09:53:00 +0800 Subject: [PATCH 01/46] Add delegate to costomize external dialog window. Openup dialog button's height, using MinHeight instead of Height. --- src/MahApps.Metro/Controls/Dialogs/DialogManager.cs | 10 ++++++++-- src/MahApps.Metro/Controls/Dialogs/InputDialog.xaml | 6 +++--- src/MahApps.Metro/Controls/Dialogs/LoginDialog.xaml | 6 +++--- src/MahApps.Metro/Controls/Dialogs/MessageDialog.xaml | 10 +++++----- src/MahApps.Metro/Controls/Dialogs/ProgressDialog.xaml | 4 ++-- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/MahApps.Metro/Controls/Dialogs/DialogManager.cs b/src/MahApps.Metro/Controls/Dialogs/DialogManager.cs index 62e1b2c8b1..7386e630ba 100644 --- a/src/MahApps.Metro/Controls/Dialogs/DialogManager.cs +++ b/src/MahApps.Metro/Controls/Dialogs/DialogManager.cs @@ -538,11 +538,14 @@ private static void RemoveDialog(this MetroWindow window, BaseMetroDialog dialog /// /// The dialog which will be shown externally. /// The owner for the external window. If it's null the main window will be use. + /// The delegate for customizing dialog window. It can be null. /// The given dialog. - public static BaseMetroDialog ShowDialogExternally(this BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null) + public static BaseMetroDialog ShowDialogExternally(this BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null, [CanBeNull] Action handleExternalDialogWindow = null) { Window win = SetupExternalDialogWindow(dialog, windowOwner); + handleExternalDialogWindow?.Invoke(win); + dialog.OnShown(); win.Show(); @@ -554,11 +557,14 @@ public static BaseMetroDialog ShowDialogExternally(this BaseMetroDialog dialog, /// /// The dialog which will be shown externally. /// The owner for the external window. If it's null the main window will be use. + /// The delegate for customizing dialog window. It can be null. /// The given dialog. - public static BaseMetroDialog ShowModalDialogExternally(this BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null) + public static BaseMetroDialog ShowModalDialogExternally(this BaseMetroDialog dialog, [CanBeNull] Window windowOwner = null, [CanBeNull] Action handleExternalDialogWindow = null) { Window win = SetupExternalDialogWindow(dialog, windowOwner); + handleExternalDialogWindow?.Invoke(win); + dialog.OnShown(); win.ShowDialog(); diff --git a/src/MahApps.Metro/Controls/Dialogs/InputDialog.xaml b/src/MahApps.Metro/Controls/Dialogs/InputDialog.xaml index c3a23e0c4e..b0b2187ed3 100644 --- a/src/MahApps.Metro/Controls/Dialogs/InputDialog.xaml +++ b/src/MahApps.Metro/Controls/Dialogs/InputDialog.xaml @@ -26,17 +26,17 @@ TextWrapping="Wrap" />