Proper way to make a wizard in a UWP application?

2019-07-14 19:31发布

问题:

I'm trying to implement a startup wizard for a UWP application. Preferably the wizard should open in a new window that is non-resizable and located at the center of the screen.

I have already tried to use LaunchUriForResultsAsync in order to launch a dummy protocol inside our own app. This way, I could open a new non-resizable window, but it had fixed size (500x500) and position (left side of the main app). Trying to call TryResizeView or to set PreferredLaunchViewSize didn't have any effect, even though they would work within the main (first) window of the same UWP app.

I could find only a couple of examples from other apps:

  • Xbox app: seem to bring a new hosted window in a new process - but I'd rather not start the wizard window in a new process.
  • Skype app: Their initial setup and the add contact dialogs seem to be just custom controls inside the main window, which looks and behaves similar to the ContentDialog but with an x button to close it.

Instead of implementing the whole wizard logic by myself, I was wondering if there's any template or best practice for this scenario within a UWP application?

回答1:

Instead of implementing the whole wizard logic by myself, I was wondering if there's any template or best practice for this scenario within a UWP application?

You could use Windows Template Studio to create UWP project and enable the 'First Run Prompt' feature.

Besides, I have some other things to share with you. It's impossible to set the position of the UWP window. So what you said 'open in a new window that is non-resizable and located at the center of the screen' was impossible.

In general, if you want to show prompt for your app's users when they first run it, you could make a separate page. Then, you could directly navigate to this page when they first open your app, instead of open a new window.

In the prompt page, you could use some controls to show different information. For example, Flip view control. You could use it to make a FlipView Page Indicator like the following:

I see many apps use such way to show their startup page. Please try it.