0
A
回答
1
試試這個:
public partial class MainPage : UserControl
{
PersonContract personContract = new PersonContract();
public MainPage()
{
InitializeComponent();
personContract.personList = new System.Collections.ObjectModel.ObservableCollection<Person>();
for (int x = 0; x < 10; x++)
{
personContract.personList.Add(new Person() { FaxNo = "123456", IdNo = "12321354321", Name = "Pieter", RegNo = "www456gp", Surname = "Stoltz", TelNo = "00129394" });
}
mygrid.DataSource = personContract.personList;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
personContract.personList.Add(new Person() { FaxNo = "123456", IdNo = "12321354321", Name = "Santie", RegNo = "www456gp", Surname = "Van den Heever", TelNo = "00129394" });
}
}
public class PersonContract
{
public System.Collections.ObjectModel.ObservableCollection<Person> personList { get; set; }
}
public class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public string TelNo { get; set; }
public string FaxNo { get; set; }
public string IdNo { get; set; }
public string RegNo { get; set; }
}
相關問題
- 1. 綁定到DomainDataSource與DataGrid中在Silverlight 3
- 2. 綁定列表到DataGrid Silverlight
- 3. Silverlight的DataGrid不綁定
- 4. Silverlight的DataGrid和綁定列
- 5. 的DataGrid的Silverlight列綁定
- 6. Silverlight DataGrid頁眉綁定
- 7. Silverlight的「條件」綁定到datagrid列?
- 8. 將WCF ObservableCollection綁定到Silverlight DataGrid
- 9. 將ObservableCollectiron綁定到Silverlight中的USER DataGrid
- 10. silverlight 3 Datagrid標題定製
- 11. Silverlight 3 DataGrid - 圓角
- 12. 綁定XElement到Datagrid
- 13. Silverlight中如何重新綁定的DataGrid
- 14. 元素綁定Silverlight 3
- 15. silverlight datagrid - 綁定每一行的樣式
- 16. 排序數據綁定Silverlight DataGrid
- 17. Silverlight datagrid綁定嵌套對象屬性
- 18. Silverlight的DataGrid行顏色綁定
- 19. WPF Silverlight的DataGrid的綁定問題
- 20. 在Silverlight中綁定DataGrid列標題
- 21. 在Silverlight Datagrid中綁定複雜類型
- 22. Silverlight DataGrid運行時添加和綁定
- 23. Silverlight DataGrid數據綁定問題
- 24. Silverlight datagrid重新綁定整個列
- 25. 幫助我綁定的Silverlight的DataGrid
- 26. 綁定DataGrid到EntitySet
- 27. Silverlight綁定到TranslateX
- 28. 什麼Linq到XML我需要將XML綁定到Silverlight Datagrid
- 29. Silverlight 3 BETA DataGrid分組
- 30. 將Datagrid綁定到XMLDatasource
呀,這似乎是做到這一點的方式,但很好的例子,開始我送行 - 乾杯 – AJM 2010-09-08 14:45:05