SL3图表中的AreaDataPoint是固定大小

时间:2010-04-19 19:06:18

标签: silverlight silverlight-3.0 charts silverlight-toolkit

在Silverlight 3中,似乎AreaDataPoint模板忽略了其ControlTemplate中设置的任何大小。

<ControlTemplate TargetType="chartingTK:AreaDataPoint">
    <Grid x:Name="Root" Opacity="1">

<!-- Width and Height are ignored -->
        <Ellipse Width="75" Height="25" 
                    StrokeThickness="{TemplateBinding BorderThickness}" 
                    Stroke="OrangeRed" 
                    Fill="{TemplateBinding Background}"/>
    </Grid>
</ControlTemplate>

有人知道解决方法吗?

1 个答案:

答案 0 :(得分:0)

一个(部分)答案是在数据点的样式中设置数据点的宽度和高度。例如:

<chartingTK:AreaSeries.DataPointStyle>
    <Style TargetType="Control">
        <Setter Property="Height" Value="25" />
        <Setter Property="Width"  Value="25" />
            <Setter Property="Template">
              <Setter.Value>
                <ControlTemplate TargetType="chartingTK:AreaDataPoint">
                    <Grid x:Name="Root" Opacity="1">

<!-- Width and Height are no longer ignored, but will still be clipped at 
     the height and width set in the style above -->
                        <Ellipse Width="75" Height="25" 
                                 StrokeThickness="{TemplateBinding BorderThickness}" 
                                 Stroke="OrangeRed" 
                                 Fill="{TemplateBinding Background}"/>
                    </Grid>
                </ControlTemplate>
              </Setter.Value>
        </Setter>
    </Style>
</chartingTK:AreaSeries.DataPointStyle>

也许不是最优的,但至少它是一个起点。