Programmatically add graph to XAML form C#

Apr 8, 2014 at 9:47 PM
Hello there!
I have to add different graphs in each new tab in TabControl. So I can't just write in XAML something like this:
  <oxy:Plot x:Name="Plot1" Title="A Graph" Model="{Binding PlotModel}">
I tried adding to Canvas using .Children.Add() but it doesn't work >_<

How can I add graph to my form from C# code during the runtime??
Apr 9, 2014 at 9:16 PM
Check ANY example.

In ViewModel:
PlotModel.Series.Add(ls);
Apr 9, 2014 at 9:27 PM
Oh no! You didn't get it. I have to declare new Plot from the C# code and then add it to Canvas and so on. I mean when I compelling my project there are not Plot blocks at all!
Apr 10, 2014 at 7:43 PM
You can add to the Model of your Plot then:
MyPlot1.Model.Series.Add(ls);
You should be using templates and bind a collection of PlotModels to a custom UserControlm