I have looked at the documentation at http://mahapps.com/controls/dialogs.html but I am still not sure how to use it. There is no documentation for ShowMetroDialogAsync().
Asked
Active
Viewed 6,808 times
7
-
await ShowMetroDialogAsync(MetroWindow, BaseMetroDialog) ? http://www.nudoq.org/#!/Packages/MahApps.Metro/MahApps.Metro/DialogManager/M/ShowMetroDialogAsync – sexta13 Apr 24 '14 at 13:38
-
1I tried that but I am not able to create the instance of BaseMetroDialog. have you tired it ? – Kunal Deo Apr 24 '14 at 13:46
-
BaseMetroDialog is an abstract class. You have to implement your own class. I have not tried... – sexta13 Apr 24 '14 at 13:55
-
1did you find the answer to this? because i m also stuck on this – wingskush Feb 03 '15 at 09:24
2 Answers
8
You have to create the dialog as a control like this:
<metro:BaseMetroDialog x:Class="Example.Dialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:metro="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
Title="My new dialog">
<TextBlock Text="Example" />
</metro:BaseMetroDialog>
Then, from another MetroWindow, you can show the dialog with something like this:
var dialog = new Example.Dialog()
await this.ShowMetroDialogAsync(dialog);

GEOCHET
- 21,119
- 15
- 74
- 98

Gustavo Cantero
- 440
- 6
- 9
-1
Add the following code:
await DialogManager.ShowMessageAsync(this, "Message Title here", "Your message description here");
The this keyword references your window
-
3The OP asked for `ShowMetroDialogAsync` not `ShowMessageAsync`. The former allows for custom content – Dec 11 '15 at 01:24