Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use ShowMetroDialogAsync() using mahapps api

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

like image 384
Kunal Deo Avatar asked Apr 24 '14 13:04

Kunal Deo


1 Answers

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);
like image 160
Gustavo Cantero Avatar answered Sep 27 '22 20:09

Gustavo Cantero