Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design Time Error - 'VisualState' occurs in at least two namespaces

Tags:

c#

.net

wpf

I am getting the following error

Ambiguous type reference. A type named 'VisualState' occurs in at least two namespaces, 'System.Windows' and 'System.Windows'. Consider adjusting the assembly XmlnsDefinition attributes.

I am not referencing any of these assembly name spaces directly, I am doing the following:

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   

The application compiles fine, just throwing these errors at design time. This happens to a few other classes that are a part of the VSM library.

like image 798
Brian Avatar asked Feb 06 '11 14:02

Brian


1 Answers

It sounds like you are trying to use the WpfToolkit compiled for WPF3.5 with WPF4. The VisualStateManager is now part of WPF4, so if you are using the toolkit for the DataGrid or VisualStateManager, you can simply remove the toolkit reference to resolve the ambiguity. If you want to use the toolkit for charting, then you should be using the WPF4 version of charting:

  • Silverlight/WPF Data Visualization Development Release 4

If you still need to use the old Toolkit with WPF4, you'll have to find all the XAML references to the VisualStateManager and related classes and prefix them with a namespace targeting the specific assembly that contains the System.Windows.VisualStateManager you want to use in order to resolve the ambiguity.

like image 191
Rick Sladkey Avatar answered Sep 17 '22 15:09

Rick Sladkey