繁体   English   中英

WPF BubbleSeries,遍历气泡并设置样式

[英]WPF BubbleSeries, iterate over the bubbles and set the style

我在图表中有一个BubbleSeries。 我将数据绑定到BubbleSeries并为气泡设置特定的颜色。

我要做的是遍历所有气泡,并根据值将每个气泡的颜色设置为特定颜色。

我的泡泡,两个系列: 替代文字

灰色气泡应始终为灰色,但蓝色气泡应根据其SizeValue具有不同的颜色。

有什么线索如何遍历气泡并设置其特定颜色? 可能?

我实际上找到了一个解决方案:

我不需要遍历气泡,而是使用ValueConverter解决了该问题。

我有一个ValueConverter,它接受一个值并根据该值返回颜色。

我将ValueConverter的响应绑定到DataPointStyle:

        <Charting:BubbleSeries.DataPointStyle>
                    <Style
                        TargetType="Charting:BubbleDataPoint">
                        <Setter
                            Property="Background">
                            <Setter.Value>
                                <SolidColorBrush
                                    Color="{Binding Path=PropertyOnObjectBoundToGraph, Converter={StaticResource colorFormater}}"></SolidColorBrush>
                            </Setter.Value>
                        </Setter>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM