datagrid的ItemsSource绑定问题
我在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?谢谢!
------------------------------------------------
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?谢谢!
...全文
相关推荐
WPF下DataGrid每行设置不同的ComboBox的数据绑定
WPF下DataGrid每行设置不同的ComboBox的数据绑定 DataGrid设置一次ItemSource 每个ComboBox也要设置一次ItemSource 有点像通过两次映射来绑定
WPF DataGrid(问题求解)
WPF窗口程序 DataGrid控件自定义ComboBox VS2010 结果:ComboBox列显示空白,下拉列表可正常显示
WPF DataGrid双向绑定
WPF DataGrid表格 mvvm双向简单绑定,适合刚接触小白
C# WPF DataGrid行拖拽顺序交换
C# WPF DataGrid行拖拽顺序交换,通过按下rowheader,移动到目标行rowheader松开,实现列表顺序交换
wpf datagrid
一部分代码被我不小心删了,没备份。哭,还没写完,不想重写,我是新手一名,新人的话可以拿去读读。嘿嘿,bug多多,勿喷。这验证码也是醉了,9438,晕。


