(WinRT) Styling a PieSeries in XAML
This discussion was imported from CodePlex
rukko wrote at 2013-03-12 11:38:
Hi
I'm trying to use a PieSeries in XAML, so that I can bind the values of the PieSlices directly to properties, letting me wrap the entire thing in a UserControl.
I'm having trouble specifying the Fill property. OxyColor does not support conversion from a string, and I can't stick one in a page resource because XAML does not support conversion from string to bytes (required to specify the R, G and B values of the colour).
Here is the XAML (where metro: is OxyPlot.Metro, and oxy is OxyPlot)
Any help?
I'm trying to use a PieSeries in XAML, so that I can bind the values of the PieSlices directly to properties, letting me wrap the entire thing in a UserControl.
I'm having trouble specifying the Fill property. OxyColor does not support conversion from a string, and I can't stick one in a page resource because XAML does not support conversion from string to bytes (required to specify the R, G and B values of the colour).
Here is the XAML (where metro: is OxyPlot.Metro, and oxy is OxyPlot)
<metro:Plot Width="50" Height="50">
<metro:Plot.Model>
<oxy:PlotModel>
<oxy:PlotModel.Series>
<oxy:PieSeries InnerDiameter="0.7"
StartAngle="-90">
<oxy:PieSeries.Slices>
<oxy:PieSlice Value={Binding Progress} Fill="???"/>
<oxy:PieSlice Value={Binding ProgressComp}/>
</oxy:PieSeries.Slices>
</oxy:PieSeries>
</oxy:PlotModel.Series>
</oxy:PlotModel>
</metro:Plot.Model>
</metro:Plot>
I wrote a converter to convert a Color to an OxyColor (and then assigning the value to the Fill property of the slice), but I receive a XamlParseException: Unable to assign to property 'Fill' at runtime.
Any help?
Customer support service by UserEcho