添加在正确的位置新行用户分类wingrid用的BindingSource
-
20-08-2019 - |
题
我使用的Infragistics的UltraGrid一个的BindingSource。
如果我添加一个新的对象,以我的绑定列表,它增加了一行,这是很好的网格的底部,如果没有用户定义的排序。
问题是,如果用户点击列标题排序的栅格,是有新行出现在正确的排序顺序,而不是总在底部的方法吗?
重新排序在每个插入件中的所有行是太昂贵了。
解决方案
似乎有点隔都的。 Infragistics的支持也表明RefreshSortPosition()方法是唯一的选择。
// Add to binding list which will trigger a row to be added to the bound ultragrid.
this.bindingList.Add(new Person("Smith", "John"));
// Get length since we know this will always be added to the end
int length = this.ultraGrid.Rows.All.Length;
// Get it to sort
this.ultraGrid.Rows[length - 1].RefreshSortPosition();
要多一点效率,你总是可以通过禁用重绘聪明,等再一批订单后请一帮行的刷新,等...
希望有所帮助。我只有很少的运气谷歌搜索这个问题。
不隶属于 StackOverflow