MEFefMVVM.ViewModelLocator.ExportViewModel不是属性类

时间:2015-07-17 10:12:40

标签: c# wpf mvvm mefedmvvm

我正在使用WPF MVVM应用程序。

我的代码如下: 视图:

<Window x:Class="MVVMDemo.View.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cinch="clr-namespace:Cinch;assembly=Cinch.WPF"
xmlns:meffed="http:\\www.codeplex.com\MEFedMVVM"
meffed:ViewModelLocator.ViewModel="AdditionViewModel"
Title="MainWindow" Height="300" Width="300">

ViewModel:

.
.
.
using Cinch;
using MEFedMVVM.ViewModelLocator;
namespace MVVMDemo.ViewModel 
{
[ExportViewModel("AdditionViewModel")]
public class AdditionViewModel : ObservableCollection<Addition> , INotifyPropertyChanged 
{
.
.
.
[ImportingConstructor]
public AdditionViewModel()
{
UpdateCommand = new GetAdditionCommand(this);
LoadGrid = new SimpleCommand<object, object>(OnLoadGrid);
}

但是在[ExportViewModel(“AdditionViewModel”)]我收到错误,因为“MEFefMVVM.ViewModelLocator.ExportViewModel不是属性类”

请帮忙。

由于 ANU

1 个答案:

答案 0 :(得分:0)

我缺少使用System.ComponentModel.Composition;

的参考