I\'ve tried to embed a .NET WinForms graph (Stephan Zimmermann\'s Graph Display) in a WPF window, under a WindowsFormsHost (I\'ve referenced both System.Windows.Forms and Wi
Could you try the following code and see if you can get a graph to display and then work from there?
MainWindow.xaml.cs
using System.Collections.Generic;
using System.Windows.Forms.DataVisualization.Charting;
using System.Windows;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
Dictionary value;
public MainWindow()
{
InitializeComponent();
value = new Dictionary();
for (int i = 0; i < 10; i++)
value.Add(i, 10 * i);
Chart chart = this.FindName("MyWinformChart") as Chart;
chart.DataSource = value;
chart.Series["series"].XValueMember = "Key";
chart.Series["series"].YValueMembers = "Value";
}
}
}
MainWindow.xaml
making sure you have references to:
%ProgramFiles%\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\WindowsFormsIntegration.dll
%ProgramFiles%\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\System.Windows.Forms.DataVisualization.dll
%ProgramFiles%\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\System.Windows.Forms.dll
I have this running after shamelessly copying the following link