1

In my UWP app, I need to get information from the user to store in a database. In standard Windows this is easy, of course, by creating a modal dialog form and instantiating it when needed.

But in UWP, although there are Dialogs, they seem limited to minimal and constrained functionality.

What I want is something at least similar to a modal dialog form, where the user would enter information I could then use to insert into the database, but the closest thing I can see available in UWP is a Page control which, I think, would effectively "replace" the main page (temporarily) if I created one for this purpose and then made it active when I needed to elicit input from the user. Is this the accepted only way to do this with UWP apps or is there a better way?

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

1 Answers1

2

You can use ContentDialog class to implement similar behavior as a model dialog.

Referring to SignInContentDialog.xaml part in the above document , you can add arbitrary UI controls to get information from the user within a panel(such as StackPanel or Grid) in ContentDialog and you can also set the size of the ContentDialog in the panel.

You can handle the data from user by adding PrimaryButtonClick and CloseButtonClick event handler(PrimaryButtonClick and CloseButtonClick are default controls of ContentDialog) or other Button controls.

YanGu
  • 3,006
  • 1
  • 3
  • 7