[COMException] INotifyPropertyChanged and LineSeries

May 21, 2013 at 9:21 AM
Edited May 21, 2013 at 9:38 AM
Hi !
First of all thank you for this great toolkit. It's an impressive work !

I'm currently using the line chart, and I'm facing a problem : everything goes right, but if I my (In)DependentValue which is bound to my LineSeries contains a change notification (INotifyPropertyChanged), the toolkit raise a COMException.

I've found this thread which said that this bug should be already resolved ? I used the last version (1.4.1) of the toolkit from Nuget.

My XAML code :
<toolkitchart:Chart x:Name="AltitudeChart" Height="200">
                    <toolkitchart:Chart.LegendStyle>
                        <Style TargetType="FrameworkElement">
                            <Setter Property="Width" Value="0"/>
                        </Style>
                    </toolkitchart:Chart.LegendStyle>
                    <toolkitchart:LineSeries
                        Title="Altitude"
                        IndependentValueBinding="{Binding Distance}"
                        DependentValueBinding="{Binding Distance}"
                        IsSelectionEnabled="True"
                        DependentRangeAxis="{Binding ElementName=LeftAxis}"
                        IndependentAxis="{Binding ElementName=BottomAxis}">
                        <toolkitchart:LineSeries.DataPointStyle>
                            <Style TargetType="toolkitchart:LineDataPoint">
                                <Setter Property="Height" Value="4"/>
                                <Setter Property="Width" Value="4"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate>
                                            <local:DetailedPushpin ManipulationDelta="DetailedPushpin_ManipulationDelta" ManipulationMode="TranslateY"/>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </toolkitchart:LineSeries.DataPointStyle>
                    </toolkitchart:LineSeries>
                    <toolkitchart:Chart.Axes>
                        <toolkitchart:LinearAxis x:Name="RightAxis" Orientation="Y" Location="Right">
                            <toolkitchart:LinearAxis.MajorTickMarkStyle>
                                <Style TargetType="Line">
                                    <Setter Property="Stroke" Value="White"/>
                                </Style>
                            </toolkitchart:LinearAxis.MajorTickMarkStyle>
                        </toolkitchart:LinearAxis>
                        <toolkitchart:LinearAxis x:Name="LeftAxis" Orientation="Y" Location="Left" Foreground="White"/>
                        <toolkitchart:LinearAxis x:Name="BottomAxis" Orientation="X" Location="Bottom" Foreground="White">
                            <toolkitchart:LinearAxis.MajorTickMarkStyle>
                                <Style TargetType="Line">
                                    <Setter Property="Stroke" Value="White"/>
                                    <Setter Property="StrokeThickness" Value="1"/>
                                </Style>
                            </toolkitchart:LinearAxis.MajorTickMarkStyle>
                        </toolkitchart:LinearAxis>
                    </toolkitchart:Chart.Axes>
                </toolkitchart:Chart>
And my C# code :
ObservableCollection<AltChartPoint> ChartPoints = new ObservableCollection<AltChartPoint>();
AltChartPoint a = new AltChartPoint(12); 
ChartPoints.Add(a);
a.Distance = 13; <-- Throw exception if the change is notified
...

 public class AltChartPoint : INotifyPropertyChanged
  {
    private double _distance;
    public double Distance 
    {
      get { return _distance; }
      set
      {
        _distance = value;
       //NotifyPropertyChanged("Distance"); <-- Problem is here
      }
    }
}
Thanks in advance,
Nicolas

EDIT : the same exception occured if i try to edit directly the LineDataPoint.DependentValue
May 23, 2013 at 10:30 AM
Anybody ? :)