How to add rows and columns to a DataGrid?

孤人 提交于 2019-12-11 06:23:32

问题


how is it possible to add rows and columns to a DataGrid?

I am trying to write two functions like:

public void addRow(DataGrid grid);
public void addColumn(DataGrid grid);

Unfortunately the DataGrid itself doesn't have those functions by default.

Thanks a lot.


回答1:


I haven't done lots with DataGrid's lately, but for as far I know, a DataGrid has a datasource, and it's the datasource that should be extended within the code.

After extending the datasource (like a datatable), you should refresh the datagrid.




回答2:


This link provides information about how to add rows to datagrid




回答3:


It doesn't have thos functions by default? What about:

dataGrid.Columns.Add


来源:https://stackoverflow.com/questions/4264916/how-to-add-rows-and-columns-to-a-datagrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!