How to I connect a ViewModel to a View when the view model has parameters in the constructor?
I'm using Prism and Unity to rewrite a WPF application using the MVVM pattern. Most of the Views are connected to the VM via the DataContext property, like so: <UserControl.DataContext> <VM:RibbonViewModel/> </UserControl.DataContext> The problem is that this method will not work when there is a parameter in the ViewModel's constructor. public RibbonViewModel(IEventAggregator eventAggregator) { this.eventAggregator = eventAggregator; } I get the error: Type 'RibbonViewModel' is not usable as an object element because it is not public or does not define a public parameterless constructor or a