Text input in message dialog? ContentDialog?

后端 未结 3 2037
说谎
说谎 2021-02-13 19:17

I am wondering what is the best way to allow a user to input text into a MessageDialog in a Windows 10 universal app.(Forgot password system). From the research I\'ve done this

3条回答
  •  野性不改
    2021-02-13 20:19

    Instead of Height=32, use this:

    public static async Task ShowAddDialogAsync(string title)
        {
            var inputTextBox = new TextBox { AcceptsReturn = false };
            (inputTextBox as FrameworkElement).VerticalAlignment = VerticalAlignment.Bottom;
            var dialog = new ContentDialog
            {
                Content = inputTextBox,
                Title = title,
                IsSecondaryButtonEnabled = true,
                PrimaryButtonText = "Ok",
                SecondaryButtonText = "Cancel"
            };
            if (await dialog.ShowAsync() == ContentDialogResult.Primary)
                return inputTextBox.Text;
            else
                return "";
        }
    

提交回复
热议问题