1 回答
TA贡献1785条经验 获得超8个赞
发布答案,以便它可以帮助像我这样的人。我能够找到这个博客帮助我的答案。正如他们所提到的,我需要在 Xaml 中添加数据上下文。
LiveChart:CartesianChart Grid.Row="1" Background="White" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:LiveChartControl}}">
<LiveChart:CartesianChart.AxisX>
<LiveChart:Axis Title="{Binding Path=XAxisTitle, Mode=TwoWay}" Labels="{Binding Path=XAxisValues, Mode=TwoWay}" MinValue="0"/>
</LiveChart:CartesianChart.AxisX>
<LiveChart:CartesianChart.AxisY>
<LiveChart:Axis Title="{Binding Path=YAxisTitle, Mode=TwoWay}" LabelFormatter="{Binding Path=Formatter, Mode=TwoWay}" MinValue="0"></LiveChart:Axis>
</LiveChart:CartesianChart.AxisY>
<LiveChart:CartesianChart.Series>
<LiveChart:LineSeries Values="{Binding Path=ChartPointsInChartValues, Mode=TwoWay}"/>
<LiveChart:VerticalLineSeries Values="{Binding Path=EnergyLineChartValues , Mode=TwoWay}"/>
</LiveChart:CartesianChart.Series>
</LiveChart:CartesianChart>
这现在开始起作用了。
- 1 回答
- 0 关注
- 248 浏览
添加回答
举报