uinput dialog uwp c# code example

Example: uinput dialog uwp c#

private async void Button_Click(object sender, RoutedEventArgs e)
{
    TextBox input = new TextBox()
    {
        Height = (double)App.Current.Resources["TextControlThemeMinHeight"],
        PlaceholderText = "Display Text"
    };
    ContentDialog dialog = new ContentDialog()
    {
        Title = "Input Dialog",
        MaxWidth = this.ActualWidth,
        PrimaryButtonText = "OK",
        SecondaryButtonText = "Cancel",
        Content = input
    };
    ContentDialogResult result = await dialog.ShowAsync();
    if (result == ContentDialogResult.Primary)
    {
        input = (TextBox)dialog.Content;
        await new Windows.UI.Popups.MessageDialog(input.Text).ShowAsync();
    }
}