RadChart 样式

发布于 2024-10-29 22:25:49 字数 962 浏览 5 评论 0原文

我正在尝试设计 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多情癖 2024-11-05 22:25:49

我们也遇到了同样的问题,但有多种控制方式。在与 Microsoft 交换信息后,他们表示 Freeze 实现中存在错误(可能会在 .NET 4.5 中修复)。与此同时,我们现在冻结了创作的画笔。

将此命名空间添加到您的 XAML:

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

然后将 po:Freeze=true 添加到您的画笔:

    <SolidColorBrush x:Key="SearchGridHeaderBrush" Color="{StaticResource DefaultHeaderColor}" 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:

    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" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文