VisualStateManager present both in WPF Toolkit and PresentationFramework - How to resolve
Asked Answered
K

3

7

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?

Kellen answered 20/1, 2012 at 11:28 Comment(0)
J
6

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,

Jerol answered 20/1, 2012 at 11:43 Comment(2)
Only /parts/ of the WPF Toolkit have been moved into the .NET 4.0 framework. VisualStateManager is one that has been moved, but as an example, Accordion is still only available in WPF Toolkit.Haim
True, but as the question referred to VSM its still the correct answerJerol
P
0

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

Peay answered 14/10, 2016 at 3:37 Comment(0)
M
0

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.

Melliemelliferous answered 21/2, 2018 at 7:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.