2

I am trying to style a RadChart. It is a bargraph and I want to change the default colors of the bars. So I used the RadChart.PaletteBrushes and defined SolidBrush colors(Found this method in the following link : http://www.telerik.com/help/wpf/radchart-styling-and-appearance-styling-chart-series.html) as follows:

<telerik:RadChart Background="Transparent" HorizontalContentAlignment="Center" HorizontalAlignment="center">
            <telerik:RadChart.PaletteBrushes>
                <SolidColorBrush Color="#FF0B3F74"/> 
                <SolidColorBrush Color="#FF721111"/> 
                <SolidColorBrush Color="#FFA1720B"/> 
            </telerik:RadChart.PaletteBrushes>
        </telerik:RadChart>

But now, an exception as follows occurs while running the application :

'System.Windows.Media.SolidColorBrush' must have IsFrozen set to false to modify.

This exception occurs randomly. Also, in the stack trace, there is a mention of RadTransition Control too. Why could this error be occuring? How can it be solved?

Sangeetha
  • 485
  • 2
  • 9
  • 24

1 Answers1

3

We also had the same problem, but with a variety of controls. After trading info with Microsoft, they said there was a bug in the Freeze implementation (fix coming in .NET 4.5, perhaps). In the meantime, we now freeze brushes on creation.

Add this namespace to your XAML:

    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"

Then add po:Freeze=true to your brushes:

    <SolidColorBrush x:Key="SearchGridHeaderBrush" Color="{StaticResource DefaultHeaderColor}" po:Freeze="true" />
Ron Clarke
  • 71
  • 3