在Datagrid WPF中添加行 [英] Add Row in Datagrid WPF
本文介绍了在Datagrid WPF中添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Datagrid中添加行的最佳方法是什么。我正在使用
What is the best way to add a row in Datagrid. I am using
AddClass data = new AddClass(234,"ABC");
dgtest.Items.Add(data);
在datagrid中添加数据行的方法。但它不起作用。当我点击按钮添加行时,它会添加带复选框的行,而不是我在数据变量中添加的数据。为什么复选框是apearing。
AddClass:
Method to add row with data in datagrid. But its not working. When i click on button to add row, it adds row with checkboxes not with the data i added in data variable. Why checkboxes are apearing.
AddClass:
class AddClass
{
public int Acol { get; set; }
public string Bcol { get; set; }
public AddClass()
{
}
public AddClass(int a, string b)
{
this.Acol = a;
this.Bcol = b;
}
}
还告诉我最好的方法来自datagrid的每个单元格的数据。
And Also tell me the best way to get data from each cell of datagrid.
推荐答案
您好,
请参阅此处的示例: HTTPS ://social.msdn.microsoft.com/Forums/vstudio/en-US/46463fc9-fda6-4bf0-80f6-cd1e66f45690/create-new-row-in-wpf-datagrid论坛= WPF [< a href =https://social.msdn.microsoft.com/Forums/vstudio/en-US/46463fc9-fda6-4bf0-80f6-cd1e66f45690/create-new-row-in-wpf-datagrid?forum=wpf target =_ blanktitle =New Window> ^ ]
http://stackoverflow.com/questions/16251327/wpf-datagrid-add-new-row [ ^ ]
Hi,
See the examples here:https://social.msdn.microsoft.com/Forums/vstudio/en-US/46463fc9-fda6-4bf0-80f6-cd1e66f45690/create-new-row-in-wpf-datagrid?forum=wpf[^]
http://stackoverflow.com/questions/16251327/wpf-datagrid-add-new-row[^]
这篇关于在Datagrid WPF中添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文