WPF Toolkit vs VS2010/WPF 4.0

Jan 3, 2011 at 3:01 PM
Edited Jan 3, 2011 at 3:18 PM

Hi all,

There have been a number of questions posted here (and elsewhere) regarding how to get the toolkit and WPF 4.0 to play nicely together, but unfortunately very few answers. I am currently trying to get to the bottom of this as I require several controls from the toolkit but want to use the standard VisualStateManager. So, this is what I have done:

  1. Downloaded source for Toolkit (Mar 6 2010 release)
  2. Loaded into VS2008 and built.
  3. Build fails (great!) due to *.Design projects referencing incorrect (Blend 4) versions of Microsoft.Windows.Design.Extensibility & Microsoft.Windows.Design.Interaction. Replaced these references with correct Framework 3.5 assemblies and the project built. NOTE: Controls.DataVisualization.Toolkit.Design requires Blend 3 assemblies not the normal framework 3.5 version!!!!
  4. Project now builds successfully in VS2008
  5. Loaded the solution into VS2010 and upgraded.
  6. Changed all projects to target ".NET  Framework 4 Client Profile"
  7. Excluded the Calendar, DataGrid, DatePicker, Themes and VSM folders from the WPFToolkit project (as I'm not using themes and the other classes are integrated into .NET 4.0).
  8. Removed all "vsm" namespace declarations and references so the toolkit uses .NET 4.0's VisualStateManager
  9. Correct a few other namespace changes (i.e. DatePicker, etc)
  10. Built.

At this point I have a single error stopping me from building a Framework 4.0 compatible version of the toolkit:

Error 4 Unknown build error, 'Method 'System.Windows.Controls.DataVisualization.Charting.DataPoint.OnApplyTemplate()' is security transparent, but is a member of a security critical type. Line 19 Position 48.' C:\Source\WPFToolkit\DataVisualization\Themes\Generic.xaml 19 48 Controls.DataVisualization.Toolkit

And I haven't got a clue what it is. Anyone?



Jan 3, 2011 at 7:18 PM
Ian, can you try to target the full .Net Framework 4 when you build the projects? Some of the assemblies that are needed for security is excluded in the client profile. Hope that works!
Jan 4, 2011 at 11:43 AM
Edited Jan 5, 2011 at 3:59 PM


Thanks for the reply.

Unfortunately I had already tried targetting the full framework to no avail. I just tried again now I've taken a more structured approach to sorting the issue out but same result: "Error 4 Unknown build error, 'Method 'System.Windows.Controls.DataVisualization.Charting.DataPoint.OnApplyTemplate()' is security transparent, but is a member of a security critical type. Line 19 Position 48.'  C:\Source\WPFToolkit\DataVisualization\Themes\Generic.xaml 19 48 Controls.DataVisualization.Toolkit"



Jan 5, 2011 at 8:45 AM
Edited Jan 5, 2011 at 8:54 AM

I got the same problem, removed this control from samples project, and builded successfully...


But, I have this error now, and don't know what its mean:



Error	3	Invalid XmlnsDeclaration occurs in assembly 'WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=null'. XmlnsDeclaration references a namespace 'System.Windows' that is not in the assembly.	C:\Projects\_Projects\MSD\Controls\WPFToolkitBinariesAndSource\Source\Samples\MainWindow.xaml	1	1	WPFToolkitSamples


Also maybe you can upload your code? I need only chart control from toolkit... But even new created window have this error. I did something wrong with a toolkit.

Jan 5, 2011 at 4:03 PM

Hi Geneziz,

I would be happy to upload the re-targetted toolkit once I have it compiling successfully, unfortunately it probably won't be any use to you in its current state as the build error I am receiving stems from the Controls.DataVisualization.Toolkit project; i.e. the chart control.

I have removed the WPFToolkit and WPFToolkitSamples projects as these were no longer required but still have the "security transparent" issue outlined above.


Jan 8, 2011 at 12:29 PM


In case anyone is interested, a moment of inspiration led me to this page on Security Transparent code. A quick read made it clear that, when targetting Framework 4, we adopted Level 2 Security Transparency, something the toolkit wasn't designed to work with. I therefore added the following assembly attribute to force compilation using Level 1 Security Transparency:

[assembly: SecurityRules(SecurityRuleSet.Level1)]

And hey presto, everything compiled. I haven't performed a significant amount of testing on the Framework 4 compiled version of the toolkit so its entirely possible that it may yet contain issues derived from this change but if anyone would like a copy of the revised toolkit let me know and I'll look to upload it somewhere.


Jan 25, 2011 at 9:18 PM

Hi ibebbs,

Have you encountered any issues with Microsoft.Windows.Design.Interaction and Microsoft.Windows.Design?

I'm trying to do the same exercise as you but I seem to be caught up in namespaces that moved. I'm trying to find PropertyEditing which used to be in Microsoft.Windows.Design.




Jan 26, 2011 at 9:13 AM

Hi Rudi,

Are you sure you have replaced the references to the Design projects with the correct Blend versions? Read Step 3 above and ensure you're using the correct versions of the Blend assemblies.

Once these are sorted out, the solution builds fine.


Jan 28, 2011 at 3:41 PM

Hi Ian,

If you don't mind I would definately like a copy.

I'm fighting with it and I'm sure I'll get it to work eventually and it would be a good exercise but having a retargeted project would also do the job ;-)



Feb 13, 2011 at 10:13 PM

Hi Ian,

Last question hopefully. I have it compiling now (removed the .Design projects completely) but only the Toolkit.dll is being generated. The solution is set to compile all projects tho.

Do you remember changing anything in order to compile all the dll's?



Feb 22, 2011 at 8:15 PM

FWIW, I went through the process of getting it all compiling in 4.0.  It took some time, but I even have the WPFToolkit updated to compile. 

The process basically entailed removing using statements, and working through the source code to add explict namespaces infront of objects. We

had made a fair amount of changes to support some internal things we were working on, which made it impossible to switch to the built in grid at this time. Perhaps when I have more time I will see about re-integrating the framework code.




Aug 2, 2011 at 9:03 PM

Any progress? Does anyone have a working dll of the toolkit without the VisualStateManager? I hope there will be a release 'WPF 4.0 compatible' without the excess stuff that is already integrated in WPF 4.0.

Aug 2, 2011 at 9:12 PM

I had the grid working in 4.0; but none of the automation stuff worked.  I scrapped it, and derived from the WPF 4.0 DataGrid and using reflector was able to extract the functionallity I needed into derived classes with the automation working.

BTW, if Microsoft would like a list of the internal and/or protected methods that are required to be able to derive and extend the functionallity of the built-in datagrid, please contact me and I will be more than happy to provide it.  Also, I was rather disappointed that the source to theDataGrid was not included in the .NET 4.0 source packages