dashnick
dashnick

Reputation: 2060

how to add .net chart component in wpf

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.

Upvotes: 3

Views: 5404

Answers (1)

Dai
Dai

Reputation: 155125

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

Upvotes: 3

Related Questions