title: WPF charting tool kit - Multiple Scatter series - Data Binding
body: <p>I am able to display a single scatter series called FinalResult via the WPF charting tool kit. </p>
  
  <pre><code> public List&lt;KeyValuePair&lt;double,double&gt;&gt; FinalResult
      {
          get
          {
              return _finalResult;
          }
          set
          {
              if (_finalResult == value) return;
              _finalResult = value;
              OnPropertyChanged("FinalResult");
          }
      }
      public List&lt;KeyValuePair&lt;double, double&gt;&gt; _finalResult;
  </code></pre>
  
  <p>In the Xaml, I just called this property as :</p>
  
  <pre><code>&lt;chartingToolkit:Chart Name="lineChart" Background = "White" Title="CDF - Charting Kit"&gt;
              &lt;chartingToolkit:ScatterSeries DependentValuePath="Value" IndependentValuePath="Key"  IsSelectionEnabled="True" 
                                                 ItemsSource="{Binding FinalResult}" /&gt;
  
              &lt;chartingToolkit:Chart.Axes&gt;
                  &lt;chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="True" /&gt;
  
                  &lt;chartingToolkit:LinearAxis Orientation="X" ShowGridLines="True" /&gt;
  
              &lt;/chartingToolkit:Chart.Axes&gt;
          &lt;/chartingToolkit:Chart&gt;
  </code></pre>
  
  <p>Now the next step is to display multiple scatter series. I thought I could use observation collection like this and use that property in the XAML but now I dont see any chart. Here is the code for that:</p>
  
  <pre><code>public class CDFPlot
      {
         public List&lt;KeyValuePair&lt;double, double&gt;&gt; FinalResult1 { get; set; }
      }
      ObservableCollection&lt;CDFPlot&gt; CDFresults = new ObservableCollection&lt;CDFPlot&gt;();
      public ObservableCollection&lt;CDFPlot&gt; CDFResults
      {
          get { return CDFresults; }
          set
          {
              CDFresults = value;
              base.OnPropertyChanged("StringList");
          }
      }
  </code></pre>
  
  <p>and then in the xaml side, I did binding to "FinalResult1". </p>
  
  <pre><code> &lt;chartingToolkit:Chart Name="lineChart" Background = "White" Title="CDF - Charting Kit"&gt;
              &lt;chartingToolkit:ScatterSeries DependentValuePath="Value" IndependentValuePath="Key"  IsSelectionEnabled="True" 
                                                 ItemsSource="{Binding FinalResult1}" /&gt;
  
              &lt;chartingToolkit:Chart.Axes&gt;
                  &lt;chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="True" /&gt;
  
                  &lt;chartingToolkit:LinearAxis Orientation="X" ShowGridLines="True" /&gt;
  
              &lt;/chartingToolkit:Chart.Axes&gt;
          &lt;/chartingToolkit:Chart&gt;
  </code></pre>
  
  <p>When I run the debug, I can see that the CDFPLOT.FinalResult1 is populated.
  Am I binding it correctly? Please advise on how can I fix it?</p>
  
  <p>Another workaround that I have tried so far is to build the chart in the code and not via xaml..</p>
  
  <pre><code> private void showChart()
      {
          CDF_PAnalysisPluginModel model = DataContext as CDF_PAnalysisPluginModel;
  
          LineSeries lineSeries1 = new LineSeries();
  
          lineSeries1.Title = "Title";
          lineSeries1.DependentValuePath = "Value";
          lineSeries1.IndependentValuePath = "Key";
  
              foreach (var x in model.CDFResults)
              {
  
                  lineSeries1.ItemsSource = x.FinalResult1;
  
               lineChart.Series.Add(lineSeries1);  // error on this line
  
              }
  
      } 
  </code></pre>
  
  <p>and xaml being:</p>
  
  <pre><code>&lt;chartingToolkit:Chart Name="lineChart" Background = "White" Title="CDF - Charting Kit"&gt;
  &lt;/chartingToolkit:Chart&gt;
  </code></pre>
  
  <p>but I get error on the line as mentioned.</p>