2010-11-15 16 views
1

我在圖表中有一個BubbleSeries。我將數據綁定到BubbleSeries併爲氣泡設置特定的顏色。WPF BubbleSeries,遍歷氣泡並設置樣式

我想要做的是遍歷所有的氣泡,並根據值將每個氣泡的顏色設置爲特定的顏色。

我的泡泡,兩個系列: alt text

灰色的泡沫應該永遠是灰色的,但藍色的氣泡應該有不同的顏色取決於他們SizeValue。

任何線索如何迭代氣泡並設置它們的特定顏色?可能?

回答

1

我居然找到了一個解決方案:

我並不需要我的氣泡迭代,而不是我的問題解決了用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>