Reputation: 1070
I have a simple WPF Application and I used Catel (3.5) framework for using MVVM. The Default structure for Catel in visual studio is:
Solution:
Project:
FolderView
FolderViewModel
FolderModel
I want to change the structure to
Solution:
ProjectView
ProjectViewModel
ProjectModel
in this way I completely separate M-VM-V and I add reference.
I Understand that Catel scans the project automatically to find the Viewmodels if the naming convention are respected.
I can not make this work on the second structure, any advice will be pretreated.
EDIT 1: I have added the following code in App.xaml.cs
var viewModelLocator = ServiceLocator.Default.ResolveType<IViewModelLocator>();
viewModelLocator.NamingConventions.Add("CatelV2ViewModel.ViewModels.[VW]ViewModel");
This does not work for me, and I have No Idea why. Im sure that My assembly name is correct AND I end my class name with ViewModel.
EDIT 2: The application Works if I add the following code:
viewModelLocator.Register(typeof(MainWindow), typeof(MainWindowViewModel));
But I still want to know why it dosent work when I add a NamingConvention.
Upvotes: 2
Views: 1518
Reputation: 5724
Catel has a lot of different naming conventions that are being used. Mostly it does this by checking the /Views, /ViewModels, /Models in the same project.
For more information about naming conventions in Catel, visit the documentation:
https://catelproject.atlassian.net/wiki/display/CTL/Naming+conventions
You probably want to customize the ViewLocator and ViewModelLocator.
Upvotes: 3