0

在 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>

有人知道解决方法吗?

4

1 回答 1

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>

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

于 2010-05-03T21:08:02.017 回答