4

如何放大这些矩形?我正在使用 wpf 工具包图表,并尝试使用控制图例,但没有帮助。

替代文字

4

1 回答 1

7

使用 Blend,在对象面板中:
右键单击 [PieSeries]
- 编辑其他模板
- 编辑 LegendItemStyle
- 编辑副本

你应该得到一个默认样式:

<Style x:Key="PieChartLegendItemStyle" TargetType="{x:Type chartingToolkit:LegendItem}">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type chartingToolkit:LegendItem}">
                <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Width="8" Height="8" Fill="{Binding Background}" Stroke="{Binding BorderBrush}" StrokeThickness="1" Margin="0,0,3,0" />
                        <visualizationToolkit:Title Content="{TemplateBinding Content}" />
                    </StackPanel>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style> 

你的控件会得到一个LegendItemStyle

<Charting:PieSeries ItemsSource="{Binding PutYourBindingHere}" 
                                    IndependentValueBinding="{Binding Key}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" LegendItemStyle="{DynamicResource PieChartLegendItemStyle}">
于 2011-06-23T11:28:29.993 回答