Hi, I recently upgraded from 2009.1 to 2009.2 of the Silverlight Data Visualization package.
Code which used to work when modifying axis properties of a xamchart now results in a null reference exception.
eg
slChart.Axes[0].AutoRange = false;
slChart.Axes[0].Maximum = 100;
slChart.Axes[0].Minimum = data.Ymin;
slChart.Axes[0].Unit = 10;
the exception occurs on the first set.
The axis object definitely exists and the properties even have values.
Hi,
Thanks for your post. Could you please attach a sample project demonstrating your issue, or supply your code? This will help me better understand what may be going on.
Thanks,
Marisa
I'm running into a NullReferenceException as well when trying to modify the axis. I have it defined in xaml and when the data is bound I want to set the min, max, and unit properties to custom values. Anyone figure out what the rules are with setting those values? Do I need to do it in a different spot or do I need to create my axis in code behind?
I've attached an application using 9.2 assemblies. The project essentially creates a PrimaryY axis in XAML, and on a button click sets Maximum, Minimum, Unit, and AutoRange = false on the PrimaryY axis. I am unable to reproduce the exception that you are seeing. Can you try this project and see if it is similar to what you're doing?
Thanks.
Ok I have worked out what the problem is and why you can't replicate.
I was modifying the properties of the axis after the axis was added to the xamwebchart.axes collection.
It appears once an axis object is added to the collection, the autorange property and max and min can no longer be changed. (this problem occurs whether the axes is added to collection by code or in xaml markup)
This is definitely introduced after 9.1 and in 9.2
I have worked round it by not adding axes til the last possible moment.
HI Marisa,
ok I will try to replicate in a smaller clean project.
I upgraded by running the 9.2 installer and deleting the old references in my sl project and adding the new ones in.
I then adjusted my xaml namespaces to 9.2. The xap file correctly contains the 9.2 files..