In a Composite Application (Prism), when my module loads, I get this error:
{"The current build operation (build key Build Key[CustomersModul.ViewModels.CustomerAllViewModel, null]) failed: The parameter view could not be resolved when attempting to call constructor CustomersModul.ViewModels.CustomerAllViewModel(CustomersModul.Views.CustomerAllView view). (Strategy type Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy, index 2)"}
I am resolving this class:
CustomerAllViewModel layoutManager = this.container.Resolve<CustomerAllViewModel>();
And that class looks like this:
public class CustomerAllViewModel : ViewModelBase
{
public CustomerAllView View { get; set; }
public ICommand TextChangeCommand { get; set; }
private Customer customer;
public CustomerAllViewModel(CustomerAllView view)
{
View = view;
view.DataContext = this;
...
Normally I resolve Presenters which have no constructor parameters and instantiate their views internally. This is the first time I am using a ViewModel which accepts a View as parameter.
Interestingly, when I go to the view with Resharper, it asks me if I want to go to the XAML or code behind, so perhaps Prism is getting confused which one to instantiate?
How can I get Prism to automatically instantiate this view (UserControl with XAML and code-behind) in the parameter?