Creating a nerw chart and adding it to a Grid control in WPF
Posted: Mon Mar 31, 2008 8:28 pm
OK, this is probably obvious. I want to dynamically create a chart and add it to a grid in WPF. I thought it would be this simple:
This will not compile, since chart is type Steema.TeeChart.Chart, and the grid requires a System.Windows.UIElement.
How do I accomplish this?
Thanks,
Mike B.
Code: Select all
//...Create a row in the grid
RowDefinition chartRowDef = new RowDefinition();
chartRowDef.Height = new GridLength(200);
MyGrid.RowDefinitions.Add(chartRowDef);
//...Create the chart
Steema.TeeChart.Chart chart = new Steema.TeeChart.Chart();
//...And add it to the grid control
MyGrid.Children.Add(chart); //<--- WONT COMPILE!
How do I accomplish this?
Thanks,
Mike B.