WPF 应用程序框架 IView 问题
WPF application framework IView issue
我正在开发 WPF PRISM 应用程序,在该工具栏区域中,我正在尝试使用 'waf' 框架注入其视图模型 类 下面是代码片段。
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
{
}
设计师代码:
public partial class ToolbarView : UserControl, IToolbarView
{
public ToolbarView()
{
InitializeComponent();
}
}
但是在编译这段代码时出现以下错误,这可能是什么问题?
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
编译器说它不能将 IToolbarView 转换为 IView。也许 IToolbarView 接口实现的 IView 类型不是 WPF Application Framework (WAF).
中的 System.Waf.Applications.IView 类型
public interface IToolbarView : System.Waf.Applications.IView
{
}
我正在开发 WPF PRISM 应用程序,在该工具栏区域中,我正在尝试使用 'waf' 框架注入其视图模型 类 下面是代码片段。
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
{
}
设计师代码:
public partial class ToolbarView : UserControl, IToolbarView
{
public ToolbarView()
{
InitializeComponent();
}
}
但是在编译这段代码时出现以下错误,这可能是什么问题?
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
编译器说它不能将 IToolbarView 转换为 IView。也许 IToolbarView 接口实现的 IView 类型不是 WPF Application Framework (WAF).
中的 System.Waf.Applications.IView 类型public interface IToolbarView : System.Waf.Applications.IView
{
}