Я использую команду Silverlight WriteableBitmap для рендеринга «круговой диаграммы» с использованием следующего кода.
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);
Результат, который я ожидал, это растровое изображение с круговой диаграммой. Я получил растровое изображение с фоном без круговой диаграммы.
Вопрос: что мне нужно сделать, чтобы круговая диаграмма отображалась в переменной 'bmapPreviewCanvas'?
Редактировать: Это имеет какое-либо отношение к ANIMATIONSEQUENCE?