datagrid的ItemsSource绑定问题

海口_菜鸟 海口_菜鸟 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在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?谢谢!
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
海口_菜鸟
WPF/Silverlight 8,757 成员 12,031 内容