PrismLibrary / Prism

Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Enhancement] NavigateFrom

dansiegel opened this issue · comments

Summary

You may find a scenario in which you may have a navigation stack like FlyoutPage/NavigationPage/ViewA/ViewB/ViewC/etc where the ViewModel's share a common shared base class that should be able to define a navigation event. The issue would be that you don't actually know how far back you need to navigate which makes it impractical to do ../../SomePage. For these scenarios we should add a NavigateFromAsync method which takes 2 arguments:

  1. The Name of the View we want to navigate from
  2. The route to navigate from that View

This API should then effectively do the same as ../../SomePage where the ../.. is replaced by going back until we found the View that was specified.

API Changes

public interface INavigationService
{
    Task<INavigationResult> NavigateFromAsync(string viewName, Uri uri, INavigationParameters parameters);
}