TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Mike B
- Newbie
- Posts: 7
- Joined: Wed Sep 07, 2005 4:00 am
Post
by Mike B » 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:
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!
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.
-
Christopher
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
-
Contact:
Post
by Christopher » Tue Apr 01, 2008 7:18 am
Hello Mike,
Mike wrote:
This will not compile, since chart is type Steema.TeeChart.Chart, and the grid requires a System.Windows.UIElement.
How do I accomplish this?
Try:
Code: Select all
private void InitializeChart()
{
RowDefinition chartRowDef = new RowDefinition();
chartRowDef.Height = new GridLength(200);
MyGrid.RowDefinitions.Add(chartRowDef);
//...Create the chart
Steema.TeeChart.WPF.TChart chart = new Steema.TeeChart.WPF.TChart();
//...And add it to the grid control
MyGrid.Children.Add(chart); //<--- WILL COMPILE!
}