【发布时间】:2014-01-21 11:49:27
【问题描述】:
我有一个这样的 ResourceDictionary 文件:
<ResourceDictionary
xmlns:vsm ="clr-namespace:System.Windows;assembly=PresentationFramework"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
...
</ResourceDictionary>
用于本页
<Page xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
x:Class="MyProject.GUI.MenuPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
....
<Page.Resources>
<ResourceDictionary Source="/GUI/ResourcesDictionary.xaml">
</ResourceDictionary>
</Page.Resources>
....
</Page>
此页面使用 wpf 工具包组件,即自动完成框,因此我将 WPFToolkit 库(可用的最新版本 here)作为项目参考。它在运行时运行良好,但我在视觉工作室设计器中收到此错误:
不明确的类型引用。名为“VisualState”的类型出现在 至少两个命名空间,“System.Windows”和“System.Windows”。考虑 调整程序集 XmlnsDefinition 属性。
这发生在 ResourceDictionary 文件的第一行(我不使用该文件中的工具包)。查看 SO 中的其他问题,我发现工具包中的类具有相同的命名空间,现在已合并到框架 4.0,所以我想我需要在 ResourceDictionary 中指定程序集,这样它就不会导入类工具包。我该怎么做?
【问题讨论】:
标签: c# .net wpf wpftoolkit