3

I am trying to use a .NET framework component in WPF - Systems.Windows.Forms.DataVisualization.Charting Chart Component - and even though I have this selected in the "Choose Toolbox Items" dialog in VS 2015, it is not showing up in my toolbox.. What am I missing and how to I correct? Thanks.

dashnick
  • 2,020
  • 19
  • 34
  • This article is very interesting too and was a much greater help to me: [Embedding winforms graph in wpf window](https://stackoverflow.com/questions/2377862/embedding-winforms-graph-in-wpf-window) – Patrick Pirzer Jan 16 '17 at 13:31

1 Answers1

3

The hint is in the namespace name: Systems.Windows.Forms.DataVisualization.Charting.Chart, it's a System.Windows.Forms component: WinForms. WPF is completely different (though its placement immediately in System.Windows (System.Windows.Controls) will lead to some confusion.

You can still use it, but you need to use System.Windows.Forms.Integration.WindowsFormsHost to host a WinForms component in a WPF XAML document, see here: https://msdn.microsoft.com/en-us/library/vstudio/ms751761(v=vs.100).aspx

Alternatively it's probably best to stick to WPF and use a WPF-based charting control, there is sage advice here: WPF chart controls

Community
  • 1
  • 1
Dai
  • 141,631
  • 28
  • 261
  • 374