日期:2014-05-20  浏览次数:20725 次

PieSeries饼图怎么绑定数据?

 <toolkit:Chart Name="cr_ProductShow" Title="市场占有率">
            <toolkit:Chart.Series>
                <toolkit:PieSeries DependentValueBinding="{Binding }" IndependentValueBinding="{Binding }"/>
            </toolkit:Chart.Series>
        </toolkit:Chart>


数据绑定

 private void Chartcontrol_Loaded(object o, RoutedEventArgs e)
        {
            List<KeyValuePair<string, int>> Companys = new List<KeyValuePair<string, int>>();
            Companys.Add(new KeyValuePair<string, int>("宝锶", 1000));
            Companys.Add(new KeyValuePair<string, int>("华为", 200));
            Companys.Add(new KeyValuePair<string, int>("三星", 600));
            Companys.Add(new KeyValuePair<string, int>("Apple", 100));
            Companys.Add(new KeyValuePair<string, int>("Nokia", 50));
            Companys.Add(new KeyValuePair<string, int>("HTC", 300));
 
            ((System.Windows.Controls.DataVisualization.Charting.PieSeries)cr_ProductShow.Series[0]).ItemsSource = Companys;     
        }



为什么右边那里有数据显示,但是饼图呢?是不是好要用个什么属性来显示?

还有个请况就是:
我改成
DependentValueBinding="{Binding Key}" IndependentValueBinding="{Binding Value}"
的时候,运行空白,页面全空白,什么情况?
谢谢啦

------解决方案--------------------
看不明