【发布时间】:2010-01-01 06:27:48
【问题描述】:
我相信我正在使用 Silverlight 3.0...我这周刚刚下载了它。假设图表命名空间引用System.Windows.Controls.DataVisualization assembly in the Silverlight Toolkit,请帮助我使用 C# 创建 DataPointStyle,如下面的 XAML 所示:
<charting:Chart
Title="Simple Column Annotations - Bottom">
<charting:ColumnSeries
DependentValuePath="Value"
IndependentValuePath="Key"
ItemsSource="{Binding}">
<!-- HERE IS WHAT I WANT TO CREATE IN C#: -->
<charting:ColumnSeries.DataPointStyle>
<Style TargetType="charting:ColumnDataPoint">
<Setter Property="Background" Value="Yellow"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="charting:ColumnDataPoint">
<Grid>
<Rectangle
Fill="{TemplateBinding Background}"
Stroke="Black"/>
<Grid
Background="#aaffffff"
Margin="0 -20 0 0"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<TextBlock
Text="{TemplateBinding FormattedDependentValue}"
FontWeight="Bold"
Margin="2"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</charting:ColumnSeries.DataPointStyle>
<!-- END -->
</charting:ColumnSeries>
</charting:Chart>
我的目标是构建一个易于使用的模板库,这些模板可以应用于图表中的系列。谢谢!
【问题讨论】:
标签: silverlight xaml