Click here to Skip to main content
15,884,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I've followed this article (which is great) : A WPF Pie Chart with Data Binding Support[^]

But I'd like to change the colors of the pie chart which are actually defined like this :

XAML
<Window.Resources>
        <x:ArrayExtension Type="{x:Type Brush}" x:Key="brushes">
            <SolidColorBrush Color="#FF8E01"/>
            <SolidColorBrush Color="#339933"/>
            <SolidColorBrush Color="#00AAFF"/>
            <SolidColorBrush Color="#818183"/>
            <SolidColorBrush Color="#000033"/>
        </x:ArrayExtension>
    </Window.Resources>
    <Grid>
        <StackPanel Orientation="Vertical">
            <c:PieChartLayout HorizontalAlignment="Center" Grid.Row="0" Grid.Column="0"
                              x:Name="piePlotter" PlottedProperty="" Margin="10">
                <c:PieChartLayout.ColorSelector>
                    <c:IndexedColourSelector Brushes="{StaticResource brushes}"/>
                </c:PieChartLayout.ColorSelector>
            </c:PieChartLayout>
        </StackPanel>
    </Grid>
</Window>



I'd like to use GradientColorBrush instead of SolidcolorBrush like this for example :
XAML
<RadialGradientBrush GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
                <GradientStop Color="#FFB9D6F7"/>
                <GradientStop Color="#FF284B70" Offset="1"/>
            </RadialGradientBrush>


How can I do this ? I've tried multiple way without success...

Thank you,
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900