Using the Prism v5.0 ViewModelLocater

Prism documentation is thorough. However, that makes it lack a certain conciseness that makes it easily digestible. One key thing that you will want to understand is how to get your views and view models connected. This post will quickly detail how to make it all work.

View Model Locator Configuration If your view model has a default constructor, it will be instantiated and matched to the view automatically. If your view models do anything interesting, they will likely not have default constructors. You will need to configure the view model locater to resolve constructor dependencies from your IOC container.

    t => container.Resolve(t)

View to view model wiring is based on convention. They are match based on name, much like the familiar MVC conventions. Be careful though, if your views are suffixed with “view”, it will not work.

✅ Do this ViewModels.MyScenicViewModel – Views.MyScenic ❌ Don't do this ViewModels.MyScenicViewModel – Views.MyScenicView

The convention can be overridden with the following configuration point.

(viewType) => {
    return viewModelType;

View Specific Wire up Your view must implement the IView marker interface found in the Microsoft.Practices.Prism.Mvvm namespace.

public partial class Wizard : Window, IView {
    public Wizard() {

And finally don't forget to set the auto wire up flag to true in your view.

<Window x:Class="MyProject.Views.Wizard"   
 Title="Wizard" Height="600" Width="800"

For a more in-depth read, check the Prism 5.0 Developers Guide.