如题所述,我正在尝试使用C#编写程序来动态添加DataGrid行,但似乎无法使其正常工作。以下是目前的代码:
// I have a DataGrid declared as dg in the XAML
foreach (string s in array) {
int index = 0;
DataGridRow dgRow = new DataGridRow();
foreach (DataGridColumn dgColumn in columns)
{
// Trying to add Text to dgRow here but IDK how
index++;
}
}
我一直在谷歌上搜索,最接近的添加内容的方法是使用{column = value}
,但是它会抛出错误。现在真的没有任何想法了:\