Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the result of ShowInputAsync Dialog in Mahapps

The ShowInputAsync() returns a string, but I want to get the result, I mean Affirmation or Cancellation, from the Dialog.

like image 456
Ragnarokkr Xia Avatar asked Feb 27 '17 13:02

Ragnarokkr Xia


1 Answers

If it returns null, it means the user hit Cancel:

    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        var result = await this.ShowInputAsync("Test", "Enter string:");

        if (result == null)
            return;

        await this.ShowMessageAsync("Test", "You entered " + result + "!");
    }

enter image description here

like image 114
jsanalytics Avatar answered Oct 20 '22 14:10

jsanalytics