在XAML文件中,我们可以通过这样改变AxisLabelStyle:Silverlight:如何在代码后面更改AxisLabelStyle?
<chartingToolkit:ColumnSeries.IndependentAxis>
<chartingToolkit:CategoryAxis Orientation="X">
<chartingToolkit:CategoryAxis.AxisLabelStyle>
<Style TargetType="chartingToolkit:AxisLabel">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="chartingToolkit:AxisLabel">
<!--some code here-->
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</chartingToolkit:CategoryAxis.AxisLabelStyle>
</chartingToolkit:CategoryAxis>
</chartingToolkit:ColumnSeries.IndependentAxis>
我的问题是:如何在代码中添加AxisLabelStyle后面?
我知道我们可以通过这样添加DataPointStyle:
ColumnSeries CS = new ColumnSeries();
CS.DataPointStyle = Application.Current.Resources["ByteBlocksColumns"] as Style;
但很显然,我们不能直接改变这样的AxisLabelStyle因为AxisLabelStyle是则CategoryAxis内。
任何人都可以提供帮助吗?谢谢!
但你可以使用类似这样的轴:_chart.ColumnSeries [0] .IndependentAxis.AxisLabelStyle = ...;我没有测试过这段代码,所以我不知道这段代码是否可以解决你的问题。 – vorrtex 2011-03-16 18:59:02
感谢您的评论。我之前尝试过,但在IndependentAxis中我找不到AxisLabelStyle。 – Mrainy 2011-03-20 19:34:20
我已经发布了适用于我的应用程序的答案。 – vorrtex 2011-03-20 22:20:52