Reputation: 930
I've developing WPF PRISM application and in that toolbar region i'm trying to inject its viewmodel using 'waf' framework classes below is the code snippet.
ViewModel:
public class ToolbarViewModel : ViewModel<IToolbarView>
{
private IUnityContainer container;
private IEventAggregator eventAggregator;
public ToolbarViewModel(IUnityContainer container, IEventAggregator eventAggregator, IToolbarView view)
: base(view)
{
this.container = container;
this.eventAggregator = eventAggregator;
}
}
IView:
public interface IToolbarView:IView
{
}
Designer code:
public partial class ToolbarView : UserControl, IToolbarView
{
public ToolbarView()
{
InitializeComponent();
}
}
But while compiling this code I'm getting below error, what could be the issue here?
Error 1 The type 'MAMA.ApplicationModule.Controllers.IToolbarView' cannot be used as type parameter 'TView' in the generic type or method 'System.Waf.Applications.ViewModel'. There is no implicit reference conversion from 'MAMA.ApplicationModule.Controllers.IToolbarView' to 'System.Waf.Applications.IView'. D:\MajorApps\SampleApp\MAMA.ApplicationModule\ViewModels\ToolbarViewModel.cs 13 18 MAMA.ApplicationModule
Upvotes: 1
Views: 736
Reputation: 7031
The Compiler says that it cannot cast IToolbarView to IView. Maybe the IView type which the IToolbarView interface implements is not the System.Waf.Applications.IView type from the WPF Application Framework (WAF).
public interface IToolbarView : System.Waf.Applications.IView
{
}
Upvotes: 1