I have a pie chart which can display up to 20 slices. I have to manually set the color for each slice using a converter.
My biggest issue is that the "object value" being passed into the converter isn't the slice datapoint but is the datacontext of the entire chart. Hence, the hard-coded converter parameter (0, 1, ...) so that I know which dataPoint slice is being converted.
So my xaml looks like this (one style per slice (20) which is BAD for maintaining):
Is there a different style which would eliminate the number of styles I have to maintain? OR a different approach?
Thanks in advance.
Tracy
My biggest issue is that the "object value" being passed into the converter isn't the slice datapoint but is the datacontext of the entire chart. Hence, the hard-coded converter parameter (0, 1, ...) so that I know which dataPoint slice is being converted.
So my xaml looks like this (one style per slice (20) which is BAD for maintaining):
<
chartView:PieSeries.SliceStyles
>
<
Style
TargetType
=
"Path"
>
<
Setter
Property
=
"Stroke"
Value
=
"Gray"
/>
<
Setter
Property
=
"StrokeThickness"
Value
=
"1"
/>
<
Setter
Property
=
"Fill"
Value
=
"{Binding Converter={StaticResource pieChartSliceToColorConverter}, ConverterParameter=0}"
/>
</
Style
>
<
Style
TargetType
=
"Path"
>
<
Setter
Property
=
"Stroke"
Value
=
"Gray"
/>
<
Setter
Property
=
"StrokeThickness"
Value
=
"1"
/>
<
Setter
Property
=
"Fill"
Value
=
"{Binding Converter={StaticResource pieChartSliceToColorConverter}, ConverterParameter=1}"
/>
</
Style
>
Is there a different style which would eliminate the number of styles I have to maintain? OR a different approach?
Thanks in advance.
Tracy