On April 27th, 2016 I gave a session at Xamarin Evolve called “MVVM Made Easy with Xamarin.Forms and Prism”. This was my first time at Evolve and I must say, it was a great event. I was especially excited about all the support Prism received in the keynote as well as in a couple of other sessions throughout the event.
As promised, I am making the demo source code and slides available to everyone. Now, I know you are wondering what took so long. Well, my session was recorded and I was waiting for it to be published before sharing all the materials. Now that the video has been published, no need to keep everyone waiting.
Here was the abstract for my session:
XAML developers have been using the MVVM design pattern since it was first introduced by John Gossman back in 2005. While MVVM has become the standard for the majority of XAML developers, there are a number of issues that have become side effects of the separations created by MVVM. In a lot of cases, more questions than answers are the result of using the MVVM pattern. Questions such as “how do I make the connection between the View and ViewModel?”, “how do I invoke actions in my ViewModels?”, “how do I communicate between ViewModels?”, “how do I navigate to other views from within my ViewModels?”, and more. Join Brian Lagunas as he walks us through how we can simplify our Xamarin.Forms applications by using the features of Prism to implement MVVM and answer all of these questions and more.
You can find the source code and slides here: https://github.com/brianlagunas/Evolve2016SamplesAndSlides/
Hi Brian
Your talk at Evolve inspired me to play around with Prism. However there’s one thing I keep on struggeling with.
In the App class that inherits from PrismApplication you can override the RegisteredTypes method to register types on the Unity container.
I want to register some services that are platform specific, so I can’t use the RegisterTypes method in the PCL. I know I can register my types via the Xamarin DependencyService (using the assembly attribute) and that Prism can auto inject them in my ViewModels.
Where can I register types directly on the container (so I can make them a singleton or register multiple types of IService)? If I register types after new App(), then the OnInitialized method is called which starts navigating before I can call appinstance.Container.
Thank you for keeping us inspired.
Jan
Actually, you brought up a great point. I haven’t considered that scenario yet. Can you submit an issue on the GitHub site so we can discuss possible solutions?
Hi Brian,
Could you please share the NavigationDeepLink project in the video? I can’t see it in Evolve2016SamplesAndSlide.
Thank you!
I don’t have a sample for that yet. You can look at the Sandbox app for a simple example though https://github.com/PrismLibrary/Prism/tree/master/Sandbox/Xamarin/HelloWorld