问题描述
我有一个DevExpress网格控件,grdcntrl在xaml中有10个固定字段(列)
项目源是使用按钮点击事件中的c#代码给出的grdcntrl,可观察集合,它有超过10个字段
工作正常并显示10列,模板中给出模板。
现在我动态地将一些字段(列)添加到grdcntrl,如下面的代码: br />
I have a DevExpress grid control, grdcntrl with 10 fixed fields(columns) in xaml
items source is given for grdcntrl using c# code in a button click event, the observable collection, which is having more than 10 fields
its working fine and showing 10 columns with templates given in xaml.
Now i added some fields(columns) to the grdcntrl dynamically like following codes:
GridColumn column = new GridColumn()
{
Name = "columnName", FieldName = "columnName", Header = "description", Width = 150
};
grdcntrl.Columns.Add(column);
工作......
但是我想设置一些值像
Worked...
But While i am trying to set some value to the cells like
List<int> lst = GridRowHandle.GetDataRowHandles(grdcntrl);
string cellvalue = "";
foreach (int rwHandle in lst)
{
cellvalue = "something1";
grdcntrl.SetCellValue(rwHandle, "columnName", cellvalue);
}
它没有将单元格值添加到grdcntrl ..它显示xaml中的10个固定列的值,并添加了带有空单元格的列。
如何在新添加的列下为单元格添加单元格值?
its not adding the cell values to the grdcntrl..Its showing the values for 10 fixed columns mensioned in xaml and added columns with empty cells.
How to add cell values to the cells under newly added columns??
推荐答案
这篇关于如何在WPF中通过c#将单元格值添加到gridcontrol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!