gpt4 book ai didi

wpf - 覆盖 WPF 工具包图表中的 DataPointStyle

转载 作者:行者123 更新时间:2023-11-30 23:52:57 25 4
gpt4 key购买 nike

我想覆盖 DataPointStyleLineSeries在我的 WPF 工具包中 Chart :

<chart:LineSeries>
<chart:DataPointSeries.DataPointStyle>
<Style
BasedOn="{StaticResource {x:Type chart:LineDataPoint}}"
TargetType="{x:Type chart:LineDataPoint}">
<Setter Property="Width" Value="20" />
<Setter Property="Height" Value="20" />
</Style>
</chart:DataPointSeries.DataPointStyle>
</chart:LineSeries>

但是,当我这样做时,我会丢失自动调色板着色,其中每个系列都有不同的颜色。申请 DataPointStyle导致它们全部变成橙色。

最佳答案

在有人提出更好的方法之前,我已经手动设置了颜色。我想我现在不会使用自动调色板。

<Style
x:Key="SimpleDataPointStyle"
BasedOn="{StaticResource {x:Type charting:LineDataPoint}}"
TargetType="{x:Type charting:LineDataPoint}">
<Setter Property="Width" Value="20" />
<Setter Property="Height" Value="20" />
</Style>

...

<chart:LineSeries ... >
<chart:DataPointSeries.DataPointStyle>
<Style
BasedOn="{StaticResource SimpleDataPointStyle}"
TargetType="{x:Type charting:LineDataPoint}">
<Setter Property="Background" Value="Green" />
</Style>
</chart:DataPointSeries.DataPointStyle>
</chart:LineSeries>
<chart:LineSeries ... >
<chart:DataPointSeries.DataPointStyle>
<Style
BasedOn="{StaticResource SimpleDataPointStyle}"
TargetType="{x:Type charting:LineDataPoint}">
<Setter Property="Background" Value="Red" />
</Style>
</chart:DataPointSeries.DataPointStyle>
</chart:LineSeries>

关于wpf - 覆盖 WPF 工具包图表中的 DataPointStyle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5042488/

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