Move PaletteBrushes to Style Resource

2 posts, 1 answers
  1. Lukas
    Lukas avatar
    42 posts
    Member since:
    Feb 2009

    Posted 30 Nov 2010 Link to this post

    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
  2. Answer
    Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 03 Dec 2010 Link to this post

    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
Back to Top