I followed this Binding the Color Series-Items
However I can't get the different colors for the bars by using telerik:RadCartesianChart. Please advise me.
<
telerik:BarSeries
CategoryBinding
=
"Category"
ValueBinding
=
"Value"
ItemsSource
=
"{Binding}"
>
<
telerik:BarSeries.PointTemplate
>
<
DataTemplate
>
<
Rectangle
Fill
=
"{Binding DataItem.Color}"
/>
</
DataTemplate
>
</
telerik:BarSeries.PointTemplate
>
</
telerik:BarSeries
>
4 Answers, 1 is accepted
0
Hello Hui,
Can you tell me what exactly doesn't work? Also, can you send me some runnable code demonstrating the issue so I can test it locally?
Regards,
Martin Ivanov
Progress Telerik
Can you tell me what exactly doesn't work? Also, can you send me some runnable code demonstrating the issue so I can test it locally?
Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
ardmore
Top achievements
Rank 1
answered on 08 Nov 2017, 02:35 PM
No bar is shown. I don't know what DataItem.Color is. Do I need to define a property named as "Color" in my ViewModel?
0
0
Accepted
Hello Hui,
Yes, the Color property should be defined in the view model of the data point. You can see this shown in the Example Data Model Definition section of the article. In this section you can also find a fully runnable code which you can copy paste into a new project and it will run. Check also the attached project.
About the Palette, this has bigger priority than the color in the DefaultVisualStyle so if you have a palette set, the brush in the style won't be respected.
Regards,
Martin Ivanov
Progress Telerik
Yes, the Color property should be defined in the view model of the data point. You can see this shown in the Example Data Model Definition section of the article. In this section you can also find a fully runnable code which you can copy paste into a new project and it will run. Check also the attached project.
About the Palette, this has bigger priority than the color in the DefaultVisualStyle so if you have a palette set, the brush in the style won't be respected.
Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.