Cannot find view for ViewModel

Topics: Conventions, Getting Started
Jun 18, 2012 at 3:19 PM

Dear experts,


I have a wpf application using Caliburn.Micro. I have a view MyView:

<UserControl x:Class="ReferenceMaintenanceWorkspace.MyView"
 <TabControl x:Name="Items" > 


I have also MyViewModel:

using System.ComponentModel.Composition;

namespace ReferenceMaintenanceWorkspace
public class MyViewModel
  public MyViewModel()
      base.DisplayName = "Reference Maintenance";

Because of some reason, I get the following message on the tab control:

Cannot find view for ReferenceMaintenanceWorkspace.MyViewModel.

Could you please explain why this could happen? Thanks.

Jun 18, 2012 at 6:51 PM
Edited Jun 18, 2012 at 6:52 PM

I see its a usercontrol how are you loading this ?  Via your ShellView/MainView and using a ContentControl? Also you might need to change how your viewmodels/views are found with the bootstrapper in the config....

for the viewlocator configuration reference this

Jun 18, 2012 at 7:37 PM

The user control is a tab item of ShellView's tab control named "Items". It is loaded like this:

      private void Activate(string item)
         var vw = (ShellView)GetView();
         vw.ReleaseInfo.Visibility= Visibility.Collapsed;

         var wspace = (from w in Workspaces.Cast<Screen>()     
                        where w.DisplayName == item
                        select w ).FirstOrDefault();

         ActivateItem( wspace );


The application I am maintaining already had various views and viewmodels. They work. They all existed in different class library projects though, and I am adding a new one called ReferenceMaintenanceWorkspace. I tried to copy everything I had in other projects, as I want the new one to work the same way, but I still must be missing something.

Jun 19, 2012 at 12:15 AM

is this in a separate library project dll?

Jun 19, 2012 at 11:36 AM

Yes, but the project is part of the same solution.