I am using the Silverlight WriteableBitmap command to render a 'Pie Chart' using the following code.
Chart GetChart()
{
Chart newChart = new Chart() { Width = 100.0,
Height = 100.0 };
PieSeries pieSeries = new PieSeries();
pieSeries.SetBinding(PieSeries.ItemsSourceProperty, new Binding());
pieSeries.DependentValueBinding = new Binding("Value");
pieSeries.IndependentValueBinding = new Binding("Key");
pieSeries.AnimationSequence = AnimationSequence.FirstToLast;
pieSeries.IsSelectionEnabled = true;
newChart.Series.Add(pieSeries);
newChart.SetValue(Chart.DataContextProperty, new KeyValuePair<string, int>[]
{
new KeyValuePair<string, int>("Work", 9),
new KeyValuePair<string, int>("Driving", 2),
new KeyValuePair<string, int>("Family", 4),
new KeyValuePair<string, int>("Sleep", 8),
new KeyValuePair<string, int>("Friends", 1)
});
return newChart;
}
WriteableBitmap bmapPreviewCanvas = new WriteableBitmap(GetChart, null);
The result I was expecting is a Bitmap with a PieChart. What I got was a Bitmap with the background without any PieChart.
Question is : What should I do to get the Pie Chart rendered in the variable 'bmapPreviewCanvas'?
Edit : Does this have something to do with the ANIMATIONSEQUENCE ?