gpt4 book ai didi

wpf 图表图例

转载 作者:行者123 更新时间:2023-12-05 00:05:53 25 4
gpt4 key购买 nike

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

alt text

最佳答案

使用 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}">

关于wpf 图表图例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4030912/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com