Implementing NavigationService for Xamarin Forms and MVVM

Sign in to queue

The Discussion

  • User profile image
    steven

    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.

  • User profile image
    Houssem​Dellai

    @Brian Lagunas thank you for the answer :) I just saw it now !

Add Your 2 Cents