Adding TextBox in winRT MessageDialog

2019-07-01 16:15发布

问题:

I'm working in windows 8 store application and I'm trying to popup a dialog to let the user enter information in a textbox for example.

How to do that ?

回答1:

The InputDialog control in WinRT XAML Toolkit does just that. It is basically a Popup control with a TextBox and some buttons. There is a sample for it too. The most basic one does this:

var dialog = new InputDialog();
var result = await dialog.ShowAsync(
    "This is the title",
    "This is the content/message",
    "Option 1",
    "Option 2",
    "Option 3");

The result is the string that is used on the button that was clicked - e.g. "Option 1".



回答2:

Using "Callisto" library, for those kind of custom Dialog box is the best option. Check out this library by elaborating it's Code Samples. Callisto Code Samples.

I really bothered by this problem and found this solution very help full. you can add anything you want in the Custom dialog box.