将通过此代码添加一行,但其为空!
tnx!
这是vb.net代码:
{
'start': '...',
'buildFront': 'tsc -p tsconfig.someName.josn'
}
这是xaml代码:
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
Dim row As String() = New String() {"aaa", "150", "2000", "10520"}
Dim dmb As New MyProduct
dmb.ItemNumber = "abc001"
dmb.ItemDescription = "bla bla bla"
dmb.ItemQty = 1
dmb.ItemUnitPrice = 123.45
grd.Items.Add(dmb)
timer1.Enabled = True
End Sub
Public Class MyProduct
Public Property ItemNumber As String
Public Property ItemDescription As String
Public Property ItemUnitPrice As Double
Public Property ItemQty As Integer
End Class
答案 0 :(得分:0)
我认为您没有正确定义Column
。您需要将其绑定到某些属性。否则,DataGrid
无法“猜测”显示内容。
尝试使用以下代码编写DataGrid.Columns
定义:
<DataGrid.Columns>
<DataGridTextColumn Header="name" Binding="{Binding ItemNumber}"/>
<DataGridTextColumn Header="desc" Binding="{Binding ItemDescription}"/>
<DataGridTextColumn Header="qty" Binding="{Binding ItemQty}"/>
<DataGridTextColumn Header="unt" Binding="{Binding ItemUnitPrice}"/>
</DataGrid.Columns>
您可以在此处查看:DataGrid tutorial,以获取有关如何使用DataGrid
的更多说明