Episode 10: Prism for Xamarin.Forms with Brian Lagunas

Play Episode 10: Prism for Xamarin.Forms with Brian Lagunas

The Discussion

  • User profile image

    Brian is awesome.
    The amount of work this guy is doing is unbelievable. Hats off to him!
    If the Xamarin Forms team would do just 20% of this one guy's work, Xamarin Forms would be much better.

  • User profile image

    Such a nice demo. I wish I had known about this before I started building my first app using XForms. It would have made my life so much easier. Lot of these features can pretty much be part of the XForms framework tbh. Navigating in XForms while maintaining MVVM sanity is not really an easy thing to do. I learned it the hard way, no regrets!

  • User profile image

    Personally, I would do it like this

    navigation.Register<MainPage>().With<int,String>("id", "name");
    or navigation.Register<MainPage>().With<int,String>();


    public int ID;
    public string Name;

    navigation.Navigate<MainPage>().With(new MainPageParam{ID = 11,Name = "alex"});

    (if MainPageParams have defaut ctr, with some magic this could work too, it could create one param object on the fly)

    this could easily support "text" navigation too

    note that i fixed the naming because i find it useless and ugly to add "Service" or "Async"
    also i register the page on the navigation service not in the container.

  • User profile image

    also i would prefer

    App.TestMode = true; (set when testing)


    when TestMode is true pass Default values and bypass visual navigation (using a stub or something)

    this way you dont need any Application NavigationService reference stored anywhere in your viewmodels.

    you could have a navigation object in a viewmodel for internal navigation tho..

    to do chaining you could return the actual viewmodel navigator if that viewmodel support IHaveNavigator.

    Dependency injection isnt the only way to make your app testable, since you are doing the APP Framework itself, this is one way i would prefer in an fluent navigation App framework.

  • User profile image
    Brian Lagunas

    @alex: Thanks for your feedback.  Unfortunately, there are a number of issues with trying to support a fluent API like you are suggesting.  For example; your desire to navigate to a concrete Page type breaks the MVVM pattern.  So, I would never consider doing that.  Even if you had the ability to navigate to a Page concrete type, you could not do deep linking with this API.  The process of building up a complex navigation stack using this API would not be possible.  In the end, this is just an coding style preference.  You do not gain anything substantial from using it.  Essentially, you are going through all this trouble to avoid using a navigation URI, which goes against the entire reason for using a URI based schema.

  • User profile image

    I started using Prism in WPF and it's been a pleasure to use it in Xamarin Forms.  Thanks Brian for all your work. 

    Hope Brian gets invited again to show the other features.

  • User profile image

    Awesome show... Thanks so much, James & Brian! As a fairly new Xamarin.Forms developer, my biggest request is for more & more sample code, and to bring Brian back on the show to discuss Prism in greater detail and in more complex situations. Maybe even a show on common "gotchas" that Prism n00bs tend to run into.


    Thanks again to both of you for all your great work!

  • User profile image

    thank you Brian Lagunas and James Montemagno very useful tutorial

  • User profile image

    Fantastic demonstration; I currently have my navigation in the view code behind based on viewmodel actions which I hate. Two questions:
    1) how difficult is this to retrospectively plumb in to a xam forms project? are there steps as to what I need to remove/add?
    2) are you aware of any issues using 3rd party components which utilise navigation. I use an ScandIt plugin that does barcode imaging and currently just call their ScanAsync method which handles navigation to the camera overlay and responds with a Task result, would Prism interfere/cause issue with this?

  • User profile image

    This is purely awesome!
    Brian also breaks the stereotype of being a nerd :D

Add Your 2 Cents