microsoft / TemplateStudio

Template Studio accelerates the creation of new WinUI 3, WPF, and UWP apps using a wizard-based experience.
Other
2.71k stars 461 forks source link

NavigationService Improvements #1122

Open mvegaca opened 7 years ago

mvegaca commented 7 years ago

Related to the issue #775 and after creating the MixedNavigationSample and write the navigation documentation we need to think about different improvements to NavigationService.

Things that we need to think about adding to MixedNavigationSample:

Things that we could think about to improve the NavegationService to reach more complex app scenarios.

This could be an approach to solve this: Add an abstraction navigation layer in NavigationService in order to navigate across the app and handle a navigation stack without depending on the frame that realizes the navigation. This implementation could mean that NavigationService becomes harder to understand and use, but it will be more powerful.

mrlacey commented 7 years ago

This issue seems confused and overly broad.

Is it about adding to the sample and related documentation, or is it about changing the service?

While the bullet points above are good on their own they also need to be more clearly defined.

Navigate to a Single page

What does this mean, how is it different to the blank project type?

Navigate between navigation pane pages

Is this something people want, need, or are asking for? What scenarios is this good for and are there any examples of apps that use this?

Give a full-screen experience to a navigation pane page

Does this relate to the "FullScreen" functionality of the ApplicationView or something else? Why would it only be relevant for apps using a navigation pane?

Add a GoHome concept (cleaning the navigation stack)

Is this being asked for explicitly? There are good reasons to have and not have this behavior in an app using a NavPanel. Adding this could mean needing more configurable versions of existing templates or forcing all generated apps down a path that isn't appropriate for all. It's often more appropriate to apps with multi level navigation or a hub and spoke model. Clearing the back stack is only a single line of code, is there a lot of demand for this or specific benefit for adding it?

Leave the navigation pane to a single page and could choose if can go back or not

Why would you not want to go back after doing this?

Think about scenarios like First use tutorial page, extended splash screen, etc.

see more below

I think it's very important to be very careful about adding to the Navigation Service.

mvegaca commented 7 years ago

I agree with you @mrlacey. I propose creating a small PoC with different navigation levels and then we decide if make some changes in NavigationService or not.

mrlacey commented 7 years ago

Define what's needed and why before creating a PoC. Otherwise you're making it up as you go along while creating the PoC.

ralarcon commented 7 years ago

Moving this to 1.5 as I don't see it urgent / required for 1.4.

mrlacey commented 7 years ago

Ok with pushing this to 1.5 but don't let this slip again. This is the finishing up of something that was only partially done for 1.3 and has other issues depending on it. This also has implications for generated projects. There are advanced features that will depend on this functionality. The longer there is before this is done, the more projects that are generated now that are likely to have issues in the future when they want to add functionality related to this.

ralarcon commented 7 years ago

@mrlacey I will move this to the backlog as we have clear priorities different than this for this milestone and the following. Sorry if this create some confusion but we need to refactor / redesign the Navigation carefully in order to be as much backward compatible as possible and the risks right now does not overcome the benefits.

myokeeh commented 5 years ago

I'm trying to move from Template 10 to WTS MVVM Light, and I can't seem to figure out basic navigation from the generated app from the template. Using these references but NavigationService doesn't seem included?

https://github.com/Microsoft/WindowsTemplateStudio/blob/dev/docs/navigation.md

mrlacey commented 5 years ago

I'm trying to move from Template 10 to WTS MVVM Light, and I can't seem to figure out basic navigation from the generated app from the template. Using these references but NavigationService doesn't seem included? https://github.com/Microsoft/WindowsTemplateStudio/blob/dev/docs/navigation.md

@myokeeh with apps generated with MVVMLight, a class called NavigationServiceEx handles the navigation. The pages it supports navigating between are configured in the constructor of the ViewModelLocator class. Actual navigation is done with something like

ViewModelLocator.Current.NavigationService.Navigate("WebViewViewModel");

If you look in ShellViewModel you'll see a wrapped version of the above call where there's a NavigationService property on the class that hides the reference to the ViewModelLocator and helpers to access items in the NavigationView so it knows where to navigate to.

In future, please raise new issues when you have questions, etc. rather than commenting on old issues. It helps us keep track of things and will get you answers faster.