自定义Silverlight toolkit 里面的 Column Chart 的data point

<Style x:Key="DataPointStyle1" TargetType="toolkit:ColumnDataPoint">
          <Setter Property="Width" Value="10"/>
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="toolkit:ColumnDataPoint">
                      <Grid>
                          <Rectangle
                                  Fill="{TemplateBinding Background}"
                                  Stroke="Black"/>
                          <Grid Background="Transparent"  Margin="0" HorizontalAlignment="Center" VerticalAlignment="Top">
                              <TextBlock  Text="{TemplateBinding FormattedDependentValue}"  FontWeight="Bold"  Margin="0,-20,0,0" VerticalAlignment="Bottom"   HorizontalAlignment="Center" />
                          </Grid>

                          <TextBlock  Text="{TemplateBinding FormattedIndependentValue}"  FontWeight="Bold"  Margin="0,-20,0,0" VerticalAlignment="Bottom"   HorizontalAlignment="Center" />

                      </Grid>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>

In Code Behind:

line.DataPointStyle = (Style)Resources["DataPointStyle1"];

原文地址:https://www.cnblogs.com/stone/p/1899314.html