"The view model of the view 'CatelValidation.DetailView' could not be resolved.

Topics: Questions
Jun 17, 2014 at 6:44 AM
Edited Jun 17, 2014 at 6:52 AM

I try to fix the issue : "https://catelproject.atlassian.net/browse/CTL-395?filter=-2"
And open the repro with the newest catel.
And I have the next problem.

In the repro the ViewModel is located in the View.
protected override Type GetViewModelType()
    return typeof(DetailViewModel);
For catel 4.0 I deleted this code in the codebehind of view.

I thougt the ViewModelLocator can automatical locate this viewmodel

Name of View: DetailView
Name of ViewModel: DetailViewModel.
  1. Files in the Same Folder
    -> Viewmodel Could not resolved
  2. ViewModel in Folder ViewModel
    -> Viewmodel Could not resolved
  3. ViewModel in Folder ViewModel
    View in Folder View
    -> Viewmodel Could not resolved
Jun 17, 2014 at 8:21 AM
The folders don't matter in Catel, because in compiled assemblies, folders only exist for resources. It's the namespaces that matter, so if you have MyApp.Views.DetailView, you should have MyApp.ViewModels.DetailViewModel.
Jun 17, 2014 at 11:22 AM
You're right. I moved it to folders bot forget to change the namespace.
Jun 17, 2014 at 11:50 AM
Next problem. No chance to get the repro to work.

Catel.Data.IModelEqualityComparer is not registered. Do I missed something again?
Jun 17, 2014 at 1:55 PM
That's weird. It is registered in CoreModule, which is called as soon as the assembly is referenced / being used for the first time.
Jun 17, 2014 at 2:19 PM
Its realy weird. I debuged in the CoreModule and now it works. I don't know if I changed everything else.
Maybe I have to download the repro again.