代码之家  ›  专栏  ›  技术社区  ›  Wonko the Sane

SL3图表中的区域数据点是固定大小

  •  0
  • Wonko the Sane  · 技术社区  · 15 年前

    在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 回复  |  直到 15 年前
        1
  •  0
  •   Wonko the Sane    15 年前

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

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

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