RadChart 样式
我正在尝试设计 RadChart 的样式。这是一个条形图,我想更改条形的默认颜色。所以我使用了 RadChart.PaletteBrushes 并定义了 SolidBrush 颜色(在以下链接中找到了此方法: http://www.telerik.com/help/wpf/radchart-styling-and-appearance-styling-chart-series.html)如下:
<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>
但是现在,运行应用程序时出现如下异常:
“System.Windows.Media.SolidColorBrush”必须将 IsFrozen 设置为 false 才能修改。
该异常是随机发生的。此外,在堆栈跟踪中,也提到了 RadTransition Control。为什么会发生这个错误?怎么解决呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们也遇到了同样的问题,但有多种控制方式。在与 Microsoft 交换信息后,他们表示 Freeze 实现中存在错误(可能会在 .NET 4.5 中修复)。与此同时,我们现在冻结了创作的画笔。
将此命名空间添加到您的 XAML:
然后将 po:Freeze=true 添加到您的画笔:
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:
Then add po:Freeze=true to your brushes: