0

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

I used the last version (1.4.1) of the toolkit from Nuget.

My XAML code :

<toolkitchart:Chart x:Name="AltitudeChart" Height="200">
  <toolkitchart:LineSeries
    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="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 x:Name="LeftAxis" Orientation="Y" Location="Left" Foreground="White"/>
    <toolkitchart:LinearAxis x:Name="BottomAxis" Orientation="X" Location="Bottom" Foreground="White"/>
  </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
    }
  }
}

Is it possible to make the chart update with an notified property update ?

Note that the same exception occured if i try to edit directly the LineDataPoint.DependentValue

Nicolas Voron
  • 2,916
  • 1
  • 21
  • 35

0 Answers0