将xaml转换为wpf中的代码c#
本文关键字:代码 wpf xaml 转换 | 更新日期: 2023-09-27 18:26:39
Hy大家好!!我想把我的xaml转换成c#代码,但我不知道如何将我的LinearSeries添加到我的图表中;我的xaml如下:
<chartingToolkit:Chart Height="369" Name="lineChart" Title="500 Premiers valeurs"
Width="608" Margin="158,97,12,95" Visibility="Hidden">
<chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Key"
ItemsSource="{Binding}">
</chartingToolkit:LineSeries>
</chartingToolkit:Chart>
谢谢你的帮助!!
lineChart.Series
是必需的属性。setter不可访问,因此需要使用Add()
方法:
lineChart.Series.Add(new LineSeries());
嵌套元素包含在由ContentProperty
属性定义的特性中。您可以使用Visual Studio检查元数据,也可以打开源代码(Chart控件的源代码在此处)。