我正在尝试学习Catel,方法是让最简单的Catel示例在VS Express 2012上工作,并不断地出错。我认为我的问题在于我的“使用”语句、引用或我的XAML中的标题。自动生成的文件写入违规行,如下面在MainWindow.g.cs中所示,代码文件非常短,因此我已经将它们包括在内。
模型、视图模型和视图被划分为三个项目,每个项目都有一个解决方案。
而错误是:
Catel.Windows.DataWindow < ViewModels.MainWindowViewModel >已经过时:‘请使用'Catel.Windows.DataWindow’代替。将在版本“4.0”中删除。C:...\MyFirstCatel\obj\Debug\MainWindow.g.cs
MainWindow.xaml
http://schemas.microsoft.com/winfx/2006/xaml/presentation”xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml“xmlns:Windows="clr-namespace:Catel.Windows;assembly=Catel.MVVM”x:TypeArguments="MainWindowViewModel:MainWindowViewModel“Title="MainWindow”Height=350“Width=”525> Hello!
MainWindow.xaml.cs
使用系统;使用System.Collections.Generic;使用System.Linq;使用System.Text;使用System.Threading.Tasks;使用System.Windows;使用System.Windows.Controls;使用System.Windows.Data;使用System.Windows.Documents;使用System.Windows.Input;使用System.Windows.Media;使用System.Windows.Media.Imaging;使用System.Windows.Navigation;使用System.Windows.Shapes;使用Catel.Windows;命名空间MyFirstCatel {公共部分类MainWindow : Catel.Windows.DataWindow { public MainWindow() { InitializeComponent();}}
MainWindowViewModel.cs
使用System.Windows;使用Catel.MVVM;命名空间ViewModels {公共类MainWindowViewModel : ViewModelBase { public MainWindowViewModel():base() }{ public重写字符串标题{ get {返回“视图模型标题”;}公共字符串段塞{ get {返回GetValue(SlugProperty);} set { SetValue(SlugProperty,值);})公共静态只读Catel.Data.PropertyData SlugProperty =RegisterProperty(“片段”,类型(字符串),null);}
在MainWindow.g.cs中
命名空间Catel.Windows {公共部分类DataWindow :Catel.Windows System.Windows.Markup.IComponentConnector {私有bool _contentLoaded;.移除邮编..。}
}
发布于 2013-06-08 21:18:14
只有一件事是错的。在xaml定义中,您仍然使用指定vm类型的旧方法。删除x:TypeArguments,错误就会消失。
https://stackoverflow.com/questions/17003725
复制相似问题