Silverlight SL3图表中的AreaDataPoint大小固定
在Silverlight 3中,AreaDataPoint模板似乎忽略了其ControlTemplate中设置的任何大小Silverlight SL3图表中的AreaDataPoint大小固定,silverlight,silverlight-3.0,charts,silverlight-toolkit,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="
<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>
有人知道解决方法吗?一个(部分)答案是在数据点样式中设置数据点的宽度和高度。例如:
<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>
也许不是最优的,但至少这是一个起点