Accordion and TransitioningContentControl in WPF 4

Jul 1, 2010 at 7:56 PM
I'm trying to use the Accordion and the TransitioningContentControl in from the Feb 16, 2010 release of the WPF toolkit in a WPF 4.0 project. Is this a valid combination? When I add references to the WPFToolkit dlls I start to get errors telling me that types have been defined more than once such as: Ambiguous type reference. A type named 'VisualStateGroup' occurs in at least two namespaces, 'System.Windows' and 'System.Windows'. Consider adjusting the assembly XmlnsDefinition attributes. and: The property 'GeneratedEasingFunction' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'. Line 36 Position 77. Is the WPF Toolkit just not supported in WPF 4 yet?
Jul 2, 2010 at 10:52 AM
I have the same problem. I am trying now to rebuild the Toolkit for WPF4, but it is a tricky business. Deleted the visual state manager stuff from the project but I have still some issues. Too bad the toolkit does not work with .Net 4 from the start.
Jul 14, 2010 at 11:34 PM

I too have the same problem. The issue seems to only be with .Net 4 and Visual Studio 2010. The issue also only causes design time problem in Visual Studio 2010 in my case. Using Expression Blend 4 design time is fine and no errors occur. Whenever using Visual Studio or Expression Blend, debugging works fine.

Jul 17, 2010 at 12:07 AM

Anyone find a solution to this? 

 

I have VS2010 and WPF toolkit.  I did not get the error until I createda  custom button and added it to a resource dictionary.  Without the overriden style in the resource dictinary, things are fine, but somethign in the overriden style is causing the VisualState error.

Jul 31, 2010 at 7:00 PM

I never did find a solution to it. My guess is that the Feb 16 release is just not compatible with WPF 4. Here's to hoping for another rev of the toolkit that is .net 4 compatible.

Aug 1, 2010 at 8:37 PM
moorster wrote:

I never did find a solution to it. My guess is that the Feb 16 release is just not compatible with WPF 4. Here's to hoping for another rev of the toolkit that is .net 4 compatible.

 I did, but forgot to post it....

 

You need to create a namespace reference and then preface all the <VisualState..> with it.  For instance, in your resourcedict you can add a namepsace ref to the toolkit like so:

 xmlns:vsm="clr-namespace:System.Windows;assembly=WPFToolkit"

 

 

 ...And then preface all the visual state mgrs like so:

<vsm:VisualStateManager...

Aug 11, 2010 at 6:02 PM

Or better if you want use the .NET 4 VSM and you need the WPF Toolkit for other components (per sample the Chart), you can add this xml namespace in your xaml files

 

 

xmlns:sw ="clr-namespace:System.Windows;assembly=PresentationFramework"

And on each class marked as marked as ambiguous, add sw: before, per sample:

<sw:VisualStateManager.VisualStateGroups>
  <sw:VisualStateGroup x:Name="CommonStates">
    <sw:VisualState x:Name="Normal" />
     <sw:VisualState x:Name="Disabled">
       <Storyboard>
          <DoubleAnimation Storyboard.TargetName="PART_DisabledVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
       </Storyboard>
     </sw:VisualState>
  </sw:VisualStateGroup>
</sw:VisualStateManager.VisualStateGroups>

If you want to continue to use the VSM of the Toolkit and not the native in .net 4, replace assembly=PresentationFramework by assembly=WPFToolkit, but it's not a good idea, a day the VSM will be removed from the toolkit.