开发者

wpf chart legend

开发者 https://www.devze.com 2023-01-21 23:22 出处:网络
How do I enlarge those rectangles ? I\'m using wpf toolkit charts and I\'ve tried to play with the control legend but it didn\'t hel开发者_开发问答ped.

How do I enlarge those rectangles ? I'm using wpf toolkit charts and I've tried to play with the control legend but it didn't hel开发者_开发问答ped.

wpf chart legend


With Blend, in the Objects panel:
Right Click on [PieSeries]
-Edit Additional Templates
-Edit LegendItemStyle
-Edit a Copy

You should get a default style:

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

And your control will get a LegendItemStyle

<Charting:PieSeries ItemsSource="{Binding PutYourBindingHere}" 
                                    IndependentValueBinding="{Binding Key}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" LegendItemStyle="{DynamicResource PieChartLegendItemStyle}">
0

精彩评论

暂无评论...
验证码 换一张
取 消