TemplateStudio icon indicating copy to clipboard operation
TemplateStudio copied to clipboard

NavigationService Improvements

Open mvegaca opened this issue 6 years ago • 8 comments

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:

  • Add a button in Navigation pane to navigate back to StartPage.
  • Improve explanations on the MVVMLight framework.

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

  • Navigate to a Single page
  • Navigate between navigation pane pages
  • Give a full-screen experience to a navigation pane page
  • Add a GoHome concept (cleaning the navigation stack)
  • Leave the navigation pane to a single page and could choose if can go back or not
  • Think about scenarios like First use tutorial page, extended splash screen, etc.

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.

mvegaca avatar Sep 11 '17 08:09 mvegaca

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.

  • It would be very easy to build a lot of functionality into it on the basis that it might be useful but not balancing how it corresponds with the overall aims of the project. (Getting people started vs trying. to build an entire app.) As more functionality is added to this service it becomes more for anyone using the generated code to have to understand. As WTS is, in part, for trying to get people started with UWP development it's important to be careful about how much is being asked of them to understand the generated code versus general UWP knowledge. (I have concerns that the ActivationService already goes too far in this respect.) WTS should not, I believe, be trying to build mini-frameworks for pieces of functionality. There's lots of potential for overlap with the 3rd party frameworks that are incorporated (MVVM Light, Caliburn, & Prism) and it distracts from the actual goals of the project.

  • Any changes made to the NavigationService but which are specific to the NavPanel project type need to be made in consideration of the NavigationView control which we'll be switching to with FCU support.

  • Need to avoid modifying the service in small amounts with each release. There are lots of other, existing, issues that relate to this (#291 #292 #293 #294 #331 #462 #482 #697 #1012 and possibly more!) Making small changes that don't consider future requirements leads to more work overall as adding related items that weren't considered as part of earlier changes means the earlier work needs altering too. The frequent change of the code is also a potential issue for people working with the generated code as they have to adapt to the changes.

mrlacey avatar Sep 11 '17 12:09 mrlacey

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.

mvegaca avatar Sep 11 '17 12:09 mvegaca

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

mrlacey avatar Sep 11 '17 12:09 mrlacey

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

ralarcon avatar Oct 02 '17 08:10 ralarcon

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.

mrlacey avatar Oct 02 '17 15:10 mrlacey

@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.

ralarcon avatar Oct 27 '17 09:10 ralarcon

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 avatar Feb 15 '19 07:02 myokeeh

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.

mrlacey avatar Feb 15 '19 19:02 mrlacey