VisualStateManager同时出现在WPF Toolkit和PresentationFramework中 - 如何解决
我必须在 WPF 窗口中使用 VisualStateManager
类,但由于我引用了两者 WPF Toolkit
的程序集和 PresentationFramework.dll
在我的项目中,C# 无法解析 VisualStateManager 类并给出如下编译错误 - “该类型同时存在于“PresentationFramework.dll”和“WPFToolkit.dll”中”,我无法继续。
如何告诉 C# 编译器使用任一程序集中的 VisualStateManager 类并使项目编译成功?
I have to use VisualStateManager
class in my WPF window, but as I have referenced the assemblies of both WPF Toolkit
and PresentationFramework.dll
in my project, C# is not able to resolve the VisualStateManager class and gives the compile error like -
"The type exists in both 'PresentationFramework.dll' and 'WPFToolkit.dll'" and I am not able to proceed.
How to tell C# compiler to use VisualStateManager class from either of the assemblies and get the project to compile successfully?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从.NET4.0开始,框架中就包含了WPF Toolkit。您应该能够删除 WPF Toolkit,更新一些命名空间,并且应用程序仍然可以编译。
这是我们在最近从 .NET3.5 升级到 .NET 4.0 的项目中采用的方法
。
Since the .NET4.0, the WPF Toolkit has been included in the framework. You should be able to remove WPF Toolkit, update some namespaces and the application still compile.
This is an approach we have taken in a project where we recently upgraded from .NET3.5 to .NET 4.0
Best regards,
我遇到了类似的问题,与 VisualStateManager 无关,而是与我用于自定义类之一的 TemplateVisualStateAttribute 有关。
根据这个问题,更改 WPFToolkit 项目引用别名为我解决了这个问题
I had a similar problem, not to do with the VisualStateManager but with the TemplateVisualStateAttribute I was using for one of my custom classes.
Changing the WPFToolkit project reference alias fixed this for me, as per this question
我遇到了同样的问题,我无法删除 ToolKit,因为我需要 AutoCompleteBox 控件,并且我不想包含和修改工具包源代码;所以我使用的解决方案是使用工具包引用的外部别名。
为此,请在 Visual Studio 中右键单击 WPFToolkit 引用并选择“属性”>>然后将“别名”字段更改为 WpfToolKit 或您选择的任何别名。
I ran into the same problem, I can not remove the ToolKit because I need the AutoCompleteBox control, and I don not want to include and modify the toolkit source code; so the solution I used was using an extern alias for the toolkit reference.
To do this in Visual Studio right click on the WPFToolkit reference and select properties >> then change the "alias" field to WpfToolKit or any alias of your choice.