c# - How to set a default color to the Pie slices in WPF Pie chart -
i using wpf pie chart labels using article zag studio.this chart refreshes new values every 1 min. works fine, why color of pie slices changes every refresh? there possible way set default color.the pie chart displaying has 2 slices.
what have tried,
<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>
this above snippet returns exception
'set property 'system.windows.resourcedictionary.deferrablecontent' threw exception.
any body help? thanks.
i have solved issue myself of post
here solution
<!--to set 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>
Comments
Post a Comment