如何为WPF饼图中的饼图切片设置默认颜色 - c#

我正在使用Zag studio中的文章将WPF饼图与标签一起使用。此图表每1分钟刷新一次新值。效果很好,但是为什么每次刷新饼图的颜色都会改变?有没有办法设置默认颜色。我显示的饼图只有两个部分。

我尝试过的

 <customControls:LabeledPieChart>
  <customControls:LabeledPieChart.Palette>
   <dv:ResourceDictionaryCollection>
   <ResourceDictionary>                                               
     <Style TargetType="dvc:PieDataPoint">
     <Setter Property="Background" Value="Green"/>
     </Style>
    <Style TargetType="dvc:PieDataPoint">
   <Setter Property="Background" Value="Purple"/>
    </Style>
  </ResourceDictionary>
  </dv:ResourceDictionaryCollection>
 </customControls:LabeledPieChart.Palette>
 </customControls:LabeledPieChart> 

上面的代码片段将异常返回为

'设置属性'System.Windows.ResourceDictionary.DeferrableContent'
引发了异常。

任何机构都可以帮忙吗?谢谢。

参考方案

我已经借助此post解决了这个问题

这是解决方案

  <!--to set the Pie slice color-->
  <SolidColorBrush x:Key="color1" Color="Maroon" />
  <SolidColorBrush x:Key="color2" Color="DarkBlue" />

  <!--Pie Palette-->
  <customControls:LabeledPieChart.Palette>
    <dv:ResourceDictionaryCollection>
      <ResourceDictionary>
        <Style x:Key="DataPointStyle" TargetType="Control" >
          <Setter Property="Background" Value="{StaticResource color1}"/>
        </Style>
      </ResourceDictionary>
      <ResourceDictionary>
        <Style x:Key="DataPointStyle" TargetType="Control" >
          <Setter Property="Background" Value="{StaticResource color2}"/>
        </Style>
      </ResourceDictionary>
    </dv:ResourceDictionaryCollection>
  </customControls:LabeledPieChart.Palette>

Div单击与单选按钮相同吗? - php

有没有一种方法可以使div上的click事件与表单环境中的单选按钮相同?我只希望下面的div提交值,单选按钮很丑代码输出如下:<input id="radio-2011-06-08" value="2011-06-08" type="radio" name="radio_date&#…

将python scikit学习模型导出到pmml - python

我想将python scikit-learn模型导出到PMML。哪个python软件包最合适?我阅读了有关Augustus的内容,但是我无法使用scikit-learn模型找到任何示例。 python大神给出的解决方案 SkLearn2PMML是 JPMML-SkLearn命令行应用程序周围的薄包装。有关受支持的Scikit-Learn Estimator和…

如何使用PHP从动态输入字段捕获数组值? - javascript

我正在编写一个在线时间跟踪网页,允许用户将学习时间输入该系统。用户将首先输入名称,然后根据日期输入学习时间。一天中可能会有多个学习时间。以下是我第一页的编码,<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"…

SOAPFaultException部署在Tomcat上时,但在GlassFish中工作正常 - java

朋友们,我一直在尝试很多,阅读了很多论坛,但无法理解为什么出现此问题。我使用契约优先方法创建了一个Jax-WS WebService。创建WSDL和XSD,然后使用wsimport工具生成其余工件,为SEI提供实现。将WebService应用程序部署到Eclipse Helios中的GlassFish(Glassfish适配器和Eclipse中安装的插件)。…

提交表单后显示模式对话框 - php

提交下载文件后,我有一张表格。我要自动而不是自动下载文件..以显示模态对话框并显示下载链接。<form name="softwareform" id="softwareform" action="../downloadlink.php" method="POST" alig…