在 WinRT api 中,如何在对话框中接受用户输入,就像在天气和财务应用程序中一样就像、应用程序、天气、财务

2023-09-06 14:14:38 作者:___゛╮安好有多好

我正在尝试显示一个允许用户键入位置的对话框,就像在 Windows 8 上的天气应用程序的添加地点"功能中一样.

I am trying to display a dialog that allows the user to type a location, just like in the "add places" function of the Weather App on Windows 8.

Windows.UI.Popups 命名空间没有适当的控件.它有 MessageDialog,但我认为不能对其进行自定义以在其中包含文本框.

Windows.UI.Popups namespace does not have an appropriate control. It has the MessageDialog, but I don't think it can be customised to include a textbox in it.

我是否需要使用 Windows.UI.XAML.Controls.Primitives.Popup 控件?

Would I need to use Windows.UI.XAML.Controls.Primitives.Popup control by any chance?

推荐答案

除了 Popup 之外没有开箱即用的控件来处理这种风格的 UI,Callisto 库经常使用这个控件,所以它有很多很好的使用示例.

There is no out of box control beyond Popup to handle this style of UI, the Callisto library uses this control quite a bit so it has a lot of good examples of it's usage.

事实上,现在 Callisto 库有 CustomDialog 控件可以帮助您做到这一点.

In fact now the Callisto library has the CustomDialog control to help you do exactly this.