datagrid的ItemsSource绑定问题
海口_菜鸟 2019-01-21 12:04:18 我在xaml.vb 有个:
------------------------------------------------
Dim infos As ObservableCollection(Of IStudents.Students) = New ObservableCollection(Of IStudents.Students)() From {
New IStudents.Students() With {.Id = 1, .Age = 11, .Name = "Tom"},
New IStudents.Students() With {.Id = 2, .Age = 12, .Name = "Darren"},
New IStudents.Students() With {.Id = 3, .Age = 13, .Name = "Jacky"},
New IStudents.Students() With {.Id = 4, .Age = 14, .Name = "Andy"}
-------------------------------------------------
1、
在xaml.vb,设置datagrid的ItemsSource = infos 这样没有问题
但是在xaml里怎么设置ItemsSource ? 我写了ItemsSource="{Binding Source=infos }" 只是得到空白表格没有数据。
2、
如果我把这个 infos 放在单独的类中又应该怎么写ItemsSource?谢谢!