通过 IDictionary对Silverlight DataGrid 进行动态数据绑定
要对DataGrid进行数据绑定,通常我们需要定义具体类,而后建立类的范式集合。如下所示: Code public class BasicInfo { public string id { set ; get ; } public string name { set ; get ; } public string tel { set ; get ; } } private void LoadDataByClass() { var result = new ObservableCollection < BasicInfo > (); result.Add( new BasicInfo { id = " 1001 " , name = " Ivan " , tel = " 135462512 " }); result.Add( new BasicInfo { id = " 1002 " , name = " Ivan2 " , tel = " 135462512 " }); result.Add( new BasicInfo { id = " 1003 " , name = " Ivan3 " , tel = " 135462512 " }); dgshow.ItemsSource = result; } 也就说说,如果要在DataGrid中show集合数据,就需要有具体类的存在