views:

50

answers:

1

In Silverlight 3, it appears that the AreaDataPoint template ignores any size set in its 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>

Does anybody know of a workaround?

A: 

One (partial) answer is to set the width and height of the datapoint in the style for the datapoint. For instance:

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

Perhaps not optimal, but at least it's a starting point.

Wonko the Sane