Search code examples
wpfmvvmprism-4

Overall application architecture with PRISM application


I am building a WPF application and plan on using the PRISM pattern library. Almost all of my views will either display or modify a list. Where should I place this object and how should I feed it to my views. Should I just have a single module, create the object in the List in that object and then feed the object to the views upon creation of the views before injecting them into the various regions? Or is there a better way to do it?


Solution

    1. You need only one module. The idea of modules is to seperate different parts of an application, e.g. order management and customer management.
    2. Following the MVVM terminology the list is your model. Just name it ListModel. This ListModel should be wrapped with one view model. This could be named ListViewModel
    3. All views have one view corresponding view model. These view models all have a reference to the ListViewModel. The ListViewModel is provided via a property to the views so the views can reference the ListViewModel using the binding path DataContext.ListViewModel. When your views are all bound to your view models it is irrelevant when your model is filled with data.