Question

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().

Was it helpful?

Solution

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);

OTHER TIPS

Add the following code:

await DialogManager.ShowMessageAsync(this, "Message Title here", "Your message description here");

The this keyword references your window

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top