This is a migrated thread and some comments may be shown as answers.

Move PaletteBrushes to Style Resource

1 Answer 56 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Lukas
Top achievements
Rank 2
Lukas asked on 30 Nov 2010, 11:23 PM
Hi,

in my app there are multiple charts and I want all of them to have the same PaletteBrushes.

I tried to move the Brush-Collection to a resource in my App.xaml but could not find out how:

Something like this:
App.xaml:
<Style x:Name="ChartStyle" x:Key="ChartStyle" TargetType="Controls:RadChart">
    <Controls:RadChart.PaletteBrushes>
        <SolidColorBrush>Black</SolidColorBrush>
        <SolidColorBrush>Blue</SolidColorBrush>
        <SolidColorBrush>Red</SolidColorBrush>
    </Controls:RadChart.PaletteBrushes>
</Style>

But this throws exception:
"Attachable property PalleteBrushes not found in type 'RadChart' "


Is there a way to do this?

Thanks
Lukas

1 Answer, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 03 Dec 2010, 09:01 AM
Hello Lukas,

At present, the PaletteBrushes property is read only so the collection can only be populated in xaml this way:

<UserControl.Resources>
       <Color x:Key="Color1">#989898</Color>
   </UserControl.Resources>
  <telerikChart:RadChart VerticalAlignment="Top" x:Name="Chart1">
       <telerikChart:RadChart.PaletteBrushes>            
           <SolidColorBrush Color="{StaticResource Color1}">                
           </SolidColorBrush>
       </telerikChart:RadChart.PaletteBrushes>
           <telerikChart:RadChart.DefaultView>
      <telerikCharting:ChartDefaultView>

Where the color resources are shared for all the chart instances in the project.
I hope this information helps. If any other questions arise, do let me know.

Kind regards,
Yavor
the Telerik team

Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
Lukas
Top achievements
Rank 2
Answers by
Yavor
Telerik team
Share this question
or