Implementing NavigationService for Xamarin Forms and MVVM

Download this episode

Download Video


Learn how to use existing NavigationService by using Prism for Xamarin Forms' platform and how to implement your own. We think about NavigationService with MVVM applications where we want to perform page navigation from within the ViewModel instead of the View, to ensure testability and extensibility.






Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      How could you combine your last video, dependency injection with xamarin forms with prism ?
      I'm trying to inject other dependencies, with iNavigationService but always get error.

      //It doesn't work, how it's the correct way?
      public MainPageViewModel(INavigationService navigationService, IMainService mainService)
      _navigationService = navigationService;
      _mainService = mainService;

    • User profile image
      Brian Lagunas

      @HoussemDellai Thanks for the great video. Keep up the good work.

      @steven: You have to register your types with the container in the RegisterTypes method in the App.cs.

      Example: Container.RegisterType<IMyService, MyService>();

      You might consider making them a singleton if possible.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.