|
■No58977 (*aka*aka* さん) に返信
DataTableをバインドする例です。
Dim ds As New DataSet
Dim tbl = ds.Tables.Add()
With tbl.Columns
.Add("Column1", GetType(String))
.Add("Column2", GetType(String))
End With
tbl.Rows.Add(New String() {"a", "b"})
tbl.Rows.Add(New String() {"c", "d"})
tbl.Rows.Add(New String() {"e", "f"})
tbl.Rows.Add(New String() {"g", "h"})
DataGrid1.Columns.Add(New DataGridTextColumn() With {.Header = "Col1", .Binding = New Binding() With {.Path = New PropertyPath("Column1")}})
DataGrid1.Columns.Add(New DataGridTextColumn() With {.Header = "Col2", .Binding = New Binding() With {.Path = New PropertyPath("Column2")}})
DataGrid1.DataContext = tbl
|