0
我用下面的代碼到一個ArrayList綁定到DataGridWPF的Datagrid刷新數據
//fill datagrid
public DataTable configData
{
get
{
DataSet dsTemp = new DataSet();
DataTable Tables = new DataTable();
dsTemp.Tables.Add(Tables);
dsTemp.Tables[0].Columns.Add("val", System.Type.GetType(
"System.String"));
foreach (string str in IMDB.ML.Class.Config.getReadPaths())
{
if (str != string.Empty)
{
DataRow myRow = dsTemp.Tables[0].NewRow();
myRow[0] = str;
dsTemp.Tables[0].Rows.Add(myRow);
}
}
return dsTemp.Tables[0];
}
}
不過,我需要能夠刷新我的數據我想補充一些新的數據列表之後。
datagrid.Items.Refresh()不工作...
的感謝!
又見網格將更新:http://stackoverflow.com/questions/1751897/how-to-get-the-wpf- toolkit-datagrid-to-show-new-rows-when-bound-to-dataset – 2009-11-23 17:24:41
您是否正在從UI線程更新DataTable? – 2009-11-23 17:25:19