|
I am struggling with this very same problem. The application runs as expected but in design mode e.g. Blend 4, it says it cannot create an instance of "ViewModelLocator". I have been tearing my hair out trying to work around this issue but I cannot resolve
it. This happened all along, but got significantly worse when I added Castle dependency injection to my application's viewmodels. IT actually doesn't matter how complicated or simple the view is - just won't create an instance.
I have done the following:
1) Created fake repositories, and I inject those when the vm is created in design mode, or let Castle do it at runtime. No improvement
2) Tried moving the references to vmLocator (ok, I admit I renamed it from Locator - but I have tried it with the default name too) from app.xaml to various usercontrols and MainWindow. No difference
3) Tried rebuilding the whole mess in Blend 4. No difference.
4) Considered creating an entirely new ViewModelLocator base class but I really want to NOT do that since I am trying to use MvvMLight as intact as possible (and Castle, etc.). This cannot possibly be so obdurate.
I am concerned it may be something blindingly obvious, which will make me feel really stupid, but I have run out of ideas on how to address this.
Any help would be appreciated.
|