具有动态生成的列的数据网格 [英] Data Grid with dymanically autogenerated columns
本文介绍了具有动态生成的列的数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在C#代码中为listview/datagri动态添加textbox列,calender列和combobox列.
请帮帮我.
谢谢
Vinaya
Hi,
how to add textbox column, calender column and combobox column dynamically in C# code for listview/datagri.
please help me.
Thanks
Vinaya
推荐答案
创建列对象,适当设置其属性,并将这些列添加到网格的columns集合中.只是普通的C#....
示例:
Create column objects, set their properties appropriately, and add the columns to the grid''s columns collection. Just regular C#....
Example:
DataGridTextColumn textcol = new DataGridTextColumn();
textcol.Header = "Column Header";
textcol.Binding = new Binding("MyColumnProperty");
dataGrid.Columns.Add(textcol);
这篇关于具有动态生成的列的数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文