我正在使用 Infragistics 2009 vol 1。
我的 UltraGrid 绑定到业务对象“A”的 BindingList,它们自己具有业务对象“B”的 BindingList 属性。它产生了两个波段:一个名为“BindingList`1”,另一个名为“ListOfB”,这要归功于货币管理器。
每当通过子业务对象和 INotifyPropertyChange 对子带执行更改时,我想刷新网格的 GroupBy 排序。
如果我按子带中的一个属性进行分组,该属性是一个布尔值(假设是“活动”),并且我使用此事件处理程序订阅了 bindinglist 数据源上的事件 ListChanged:
void Grid_ListChanged(object sender, ListChangedEventArgs e)
{
if (e.ListChangedType == ListChangedType.ItemChanged)
{
string columnKey = e.PropertyDescriptor.Name;
if (e.PropertyDescriptor.PropertyType.Name == "BindingList`1")
{
ultraGrid.DisplayLayout.Bands[columnKey].SortedColumns.RefreshSort(true);
}
else
{
UltraGridBand band = ultraGrid.DisplayLayout.Bands[0];
UltraGridColumn gc = band.Columns[columnKey];
if (gc.IsGroupByColumn || gc.SortIndicator != SortIndicator.None)
{
band.SortedColumns.RefreshSort(true);
}
ColumnFilter cf = band.ColumnFilters[columnKey];
if (cf.FilterConditions.Count > 0)
{
ultraGrid.DisplayLayout.RefreshFilters();
}
}
}
}
调用了 band.SortedColumns.RefreshSort(true),但是当子带中的 Active 属性发生更改时,它会在 groupby 区域中产生不可预测的结果:
如果三个活动对象中的一个对象变为非活动对象,则它来自:
- 主动:真(3 项)
至:
- 主动:错误(3 项)
而不是(当我将列来回拖动到按区域分组时就是这种情况)
活动:错误(1 项)
主动:真(2 项)
难道我做错了什么?
执行 RefreshSort(true); 时有没有办法恢复行的展开状态??