I am trying to make a simple line graph using WPF toolkit and I am running into problems that I can't seem to resolve.
The relevant part of my XAML code is:
<DockPanel Grid.Column="1" Grid.Row="2">
<charting:Chart Name="orignialDataGraph" VerticalAlignment="Top" Height="474" Title="Original Signal">
<charting:Chart.Series>
<charting:LineSeries Title="Original"
DependentValueBinding="{Binding SamplePeriod}"
IndependentValueBinding="{Binding TraceValue}">
</charting:LineSeries>
</charting:Chart.Series>
</charting:Chart>
</DockPanel>
And the code behind:
private void LoadSignals_Click(object sender, RoutedEventArgs e)
{
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
ofd.InitialDirectory = ofd.FileName;
try
{
string fileName = ofd.FileName;
StudyFile sf = new StudyFile(fileName);
studyDataList = sf.GetStudyData();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
LineSeries ls = (LineSeries)orignialDataGraph.Series[0];
ls.ItemsSource = studyDataList;
}
I get the following error:
A first chance exception of type 'System.ArgumentNullException' occurred in System.Windows.Controls.DataVisualization.Toolkit.dll
I've googled to see if I can find something relevant but the ones I could find were only relevant to silverlight (which I don't know much of except for its name). I've checked and confirmed that "studyDataList" list is populated. Can anyone give a helping hand? Thanks.