我有一个问题。我有一个数据网格,我想添加一个删除行的按钮。是否可以在datagrid中显示按钮。我在windows ce操作系统上运行这个程序。我试着像这样使用它;
var f = shelfControlList.ToList();
List<ShelfControl> sortedProductList = new List<ShelfControl>();
sortedProductList.AddRange(f);
dataTable = new DataTable("InBox");
dataTable.Columns.Add("Name");
dataTable.Columns.Add("Publisher");
dataTable.Columns.Add("ButtonCell");
dataGrid1.PreferredRowHeight = 30;
foreach (var sp in sortedProductList)
{
Button deleteButton = new Button();
deleteButton.Text = "Delete";
deleteButton.BackColor = Color.Red;
deleteButton.Width = 30;
this.btnDelete.Click += new System.EventHandler(this.deleteButton_Click_1);
this.Controls.Add(deleteButton);
dataTable.Rows.Add(sp.name, sp.publisher, deleteButton);
}
dataGrid1.DataSource = dataTable;
提前致谢。