On June 30th, I presented a joint webinar for Infragistics and Pluralsight titled “MVVM Made Simple With Prism”. Unfortunately, the first 5 minutes didn’t get recorded.
Here is the abstract from that webinar:
“WPF 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 WPF 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: “How do I make the connection between the View and ViewModel?”, “How do I invoke actions in my ViewModels?”, etc. In this joint webinar presented with Pluralsight, Infragistics’ own Brian Lagunas will answer all these questions and more as he walks us through simplifying our WPF applications by using the features of Prism to implement MVVM.”
Attendees of this webinar can find our demo application source code here on my GitHub.
I want to thank everyone that attended, and I hope you found some value in the session. As always, feel free contact me on my blog, connect with me on Twitter (@brianlagunas), or leave a comment below for any questions or comments you may have.
Excellent post on the Prism 6 stuff. I missed the webinar which was a shame but caught up now. Prism 6…. when is it likely to come out? Very good and interesting stuff. Side Question…. I’ve been a MEF head (MEF framework not that other stuff) and interested on your choice of Unity. Thinking of switching….
You guys heading to UK at all this year?
We don’t have a set date, as this is a project we work on in our spare time. Plus, we have some more features we will be adding.
I use Unity because its an actual DI container, where MEF is not. MEF does DI container type things, but it is not a container. I always recommend using an actual container when resolving known types. You can use MEF for unknown types, which are mainly the case in an extension scenario where you have unknown 3rd parties extending your application (think plugins).
I already had my trip to the UK this year, so it won’t be until next year before I go back.
You are very correct. I went with MEF and Prism a while ago thinking about plugin architecture however things did not work out that way when companies changed. Now thinking about it, Unity would have been a better choice for the project now but MEF still does a good job.
I really liked the webinar and looking forward to Prism 6. Anyway good work and happy coding!!!!!
Nice video, I was wondering if you can give me hint how to do a “bootstrapper” for an Excel Application add-in.
I built an application in C# with the ExcelDna library. I use xaml & basic MVVM for user interaction. Since I’m adding more and more stuff and I want to improve maintainability and would like to leverage Prism (regions & event aggregation).
Commanding and viewmodellocator is working in my Excel add-in like in your example but I have difficulties with the shell part since I’m running under Excel. I’m not sure how to replace the bootstrapper with a version which runs in Excel.
That’s an interesting scenario. I’ve never considered using Prism for Office add-ins. I’m not really sure how to answer your question right now, as I have never tried it myself. My first thought is that you will need to create a custom bootrapper, register the services you require, and modify how the CreateShell and InitializeShell logic is executed to fit within the Excel add-in.
I created an Event class for messaging based on the Prism EventAggregator. That works ok but requires more manual steps. I will take a look if I can create a customer Excel bootstrapper.
Sorry for the late reply, I haven’t been getting notifications of new comments for some reason. I had a thought. You could try just returning null in the CreateShell method, and all the other services will be initialized properly.
Loving Prism 6 and your Pluralsight training videos.
You mention in the video that you’re going to publish Prism specific code snippets, do you have a link?
Not yet. I have been working on other higher priorities, but this is still on my backlog.
No worries. Completely understandable.
in your example you are only having ViewModels and Views but how can I bind a model to the ViewModel if everything is done by magic? Do you have an example for a typical use case with a list view and a detail view?
I’m not sure what you mean. You don’t bind models to ViewModels. You declare a property of your Model type that will contain the instance of your model in your VM and then bind your View to that (Binding MyModelPropertyInTheViewModel.FirstName). I am also not sure what you are looking for regarding a list view and a detail view. there are so many ways to so that pattern and depending on the platform it will be different.
sorry, its hard for me to describe my problem, my english is very bad 🙂 I want to know how I can set the model property in my VM if the instance of the VM is created automatically by prism?
Do I really bind MyModelPropertyInTheViewModel.FirstName in my view? Do I have to implement bindablebase in my model and VM in this case?
Yes, your Models are exposed by properties in your VM. Both your Model and VM should implement INPC. You don’t have to do it this way if you don’t want, but it is the easiest and it’s what I recommend.
That’s very good Introduction to Prism 6. As far as I know about Prism 6, I really like all the features of it.
As a normal developer, I work very convenient on framework feature if I have a sample application about that feature. I know Prism 6 has a lot of samples on github.
So that I would like to request a favor from you to implement the sample of CRUD application using the WPF + Prism 6 + Entity Framework. There are a lot of questions on StackOverFlow that request this kind of demo. I totally understand that Prism is so out of topic from Entity Framework and Database matters. But most of LoB applications are this combination of technologies on today. So I really desire to see the guidance of Code Structure and Prism Features Usage on this subject matter from the respectable developer like you.
Thanks you very much.
That type of sample really is outside the scope of Prism and what Prism does. Using EF in an MVVM app is just general app dev concepts. Also, this is such a low priority, I would never get around to it anyways. Our current samples are few and need lots of improvements too which I don’t have time for.
By chance have you updated the igOutlook sample mentioned in the Webinar to Prism 6? I’m evaluation both Prism and IG for an upcoming project. Thanks!
No I don’t. Sorry
Thank you for an enligtning video on PRISM for WPF.
I have tried to implement you example and want to preload ViewA on startup. How do you do that? I have tried to fire of the Navigate method with url = “ViewA” but this doesn´t seem to work
Kind regards Kresten
Start here: https://github.com/PrismLibrary/Prism/blob/master/Documentation/Xamarin.Forms/1-GettingStarted.md