Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WinrtXamlToolkit-图表:更改INotifyPropertyChanged使用时的ComException_C#_Charts_Windows Runtime_Comexception - Fatal编程技术网

C# WinrtXamlToolkit-图表:更改INotifyPropertyChanged使用时的ComException

C# WinrtXamlToolkit-图表:更改INotifyPropertyChanged使用时的ComException,c#,charts,windows-runtime,comexception,C#,Charts,Windows Runtime,Comexception,我目前正在使用折线图(来自WinRT XAML工具包),我面临一个问题:一切正常,但如果绑定到我的LineSeries的(In)DependentValue包含更改通知(INotifyPropertyChanged),工具包将引发COMException 我使用了Nuget的工具包的最新版本(1.4.1) 我的XAML代码: <toolkitchart:Chart x:Name="AltitudeChart" Height="200"> <toolkitchart:Line

我目前正在使用折线图(来自WinRT XAML工具包),我面临一个问题:一切正常,但如果绑定到我的LineSeries的(In)DependentValue包含更改通知(INotifyPropertyChanged),工具包将引发COMException

我使用了Nuget的工具包的最新版本(1.4.1)

我的XAML代码:

<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>

和我的C#代码:

ObservableCollection ChartPoints=新的ObservableCollection();
AltChartPoint a=新的AltChartPoint(12);
添加(a);

a、 距离=13;更正-工具包不会抛出com异常,它必须是正在执行该操作的平台,老实说!)您是从dispatcher线程进行更新吗?哦,我认为这是无效的:
DependentRangeAxis=“{Binding ElementName=LeftAxis}”
谢谢您的回答。是的,更新是从dispatcher线程完成的。为什么DependentRangeAxis行无效?就我所知,它的编译和运行良好(除了我目前的问题)?
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
    }
  }
}