We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically set the value for PieSeries.ColorModel

Thread ID:





119604 Jul 14,2015 08:22 AM UTC Jul 15,2015 04:06 AM UTC WPF 2
Tags: SfChart
Krishna Kumar Nanjundaprasad
Asked On July 14, 2015 08:22 AM UTC


Hope you are doing well.

Can you please let me know if there is a possibility to set the ColorModel for a SfChart.PieSeries programmatically?
I achieved till setting the value for ChartColorModel which is as follows;

ChartColorModel colorModel = new ChartColorModel();
colorModel.CustomBrushes.Add((SolidColorBrush)(new BrushConverter().ConvertFrom("#49B792")));
colorModel.CustomBrushes.Add((SolidColorBrush)(new BrushConverter().ConvertFrom("#FCBF00")));
colorModel.CustomBrushes.Add((SolidColorBrush)(new BrushConverter().ConvertFrom("#B3181F")));

Now I facing a problem to add this ChartColorModel to PieSeries.ColorModel or I can say I don't know how to add this ChartColorModel to the PieSeries.ColorModel in C#.
Please help me with this.

Thank you very much in advance.

Best Regards,
Krishna Kumar

Krishna Kumar Nanjundaprasad
Replied On July 14, 2015 10:40 AM UTC


Fortunately, I bound the created object to the ColorModel property of the pie series and it worked.
Thanks again.

Code for reference;
<sfchart:PieSeries DockPanel.Dock="Left" LabelPosition="Inside" sfchart:ChartTooltip.EnableAnimation="True"
                                   ItemsSource="{Binding ChartData}" XBindingPath="{Binding XBindingPathValue}" YBindingPath="{Binding YBindingPathValue}" PieCoefficient="0.50" 
                                   EnableSmartLabels="True" SelectedIndex="{Binding SelectedChartSegmentIndex,Mode=TwoWay}"
                                   ShowTooltip="True" HorizontalContentAlignment="Left" Width="auto"
                                   Margin="-50,-50,-50,-50" FontSize="20" FontWeight="Bold"
                                   Palette="Custom" ColorModel="{Binding colorModel}">

Best regards,
Krishna Kumar

Rachel A [Syncfusion]
Replied On July 15, 2015 04:06 AM UTC

Hi Krishna,

Thanks for the update.

Please let us know if you need any further assistance.

Rachel. A


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon