DataGrid的必然数据表不清爽值 [英] DataGrid bound to Datatable not refreshing Values
本文介绍了DataGrid的必然数据表不清爽值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经被绑定到一个DataTable(LastDatasets)
I've a DataGrid which is bound to a DataTable ("LastDatasets")
当我通过这个code刷新计时器的数据表:
When I refresh the DataTable in a Timer via this code:
if (LastDatasets != null)
{
var maxRow = LastDatasets.Select("id = MAX(id)").FirstOrDefault();
var newds = dataInterface.ReadFromDatabase("SELECT * FROM daten WHERE id > " + dataInterface.SqlSep + "id LIMIT 30", new Dictionary<string, object>() {{"id", maxRow["id"]}});
if (newds != null && newds.Rows.Count > 0)
{
LastDatasets.Merge(newds);
}
}
我的DataTable包含我的新数据,但在DataGrid的WPF没有刷新!
My DataTable contains my new data, but the DataGrid in WPF is not refreshed!
推荐答案
我用简单的绑定,我可以看到.Merge后的所有更改()。所以你应该张贴一些code,看看怎么回事错了。
i use simple binding and i can see all changes after .Merge(). so you should post some more code to see whats going wrong.
<DataGrid ItemsSource="{Binding MyDataTable}" />
vm.cs
MyDataTable.Merge(newdata);
这篇关于DataGrid的必然数据表不清爽值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文