zhangzy0193 / visifire

Automatically exported from code.google.com/p/visifire
1 stars 4 forks source link

NullReferenceException in Axis.cs (OnAxisLabelsPropertyChanged) #300

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Visifire Version           : 3.6.4
Silverilght / WPF          : WPF
Managed Code / JavaSctipt  : Managed Code
Browser and its Version    : N/A

What steps will reproduce the problem?
Dynamic visualization of graphs using ContentControl and DataTemplates, e.g.:
...
<Style x:Key="GraphsStyle" TargetType="{x:Type ContentControl}">
  <Style.Resources>
    <DataTemplate DataType={x:Type SomeDerivedType1}>
       <Visifire:Chart with bound dataseries>
    </DataTemplate>
    <DataTemplate DataType={x:Type SomeBaseType}>
       <TextBlock Text="No charts implemented" />
    </DataTemplate>
  </Style.Resources>
</Style>
...
<Grid>
<ContentControl Style="{StaticResource GraphsStyle}" Content={Binding 
SomeInstance}/>
</Grid>
...

What is the expected result?
WPF Should silently display the Second datatemplate for all other deriving 
types of SomeBaseType

What happens instead?
It seems to set the bindings to null for all other templates, resulting in a 
NullReferenceException in Axis.cs(OnAxisLabelsPropertyChanged)

Please provide any additional information below.
The AxisLabel property of the variable axis in line 2562 is null. 
To fix this issue in version 3.6.4, add the following after line 2562 in 
Axis.cs:
            if (axis.AxisLabels == null)
                return; 

Original issue reported on code.google.com by edval...@gmail.com on 24 Nov 2010 at 1:55