<分区>
我关注这个Guide in codeproject .
因此,我将其添加到 AssemblyInfo.cs 中:
[assembly: XmlnsPrefix("http://my-project.com/wpf", "g")]
[assembly: XmlnsDefinition("http://my-project.com/wpf", "GUI.View.Result")]
[assembly: XmlnsDefinition("http://my-project.com/wpf", "GUI.ViewModel.Result")]
然后我在 xaml 中像这样使用它:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:g="http://my-project.com/wpf">
<DataTemplate DataType="{x:Type g:ResultListViewModel}">
<g:ResultListView/>
</DataTemplate>
</ResourceDictionary>
我有以下错误:
The name "ResultListView" does not exist in the namespace "http://my-project.com/wpf"
The name "ResultListViewModel" does not exist in the namespace "http://my-project.com/wpf"
我是不是做错了什么。 这不是对另一个项目的引用,所有这些代码都在同一个 VS2012 项目中。
有什么想法吗?请问?
谢谢!