Hi
I have a WinGrid with a column that is set to MergeCellEvaluationType = MergeSameText and MergedCellStyle = Always. This works just fine, except whenever the underlying data changes, the changed data is not reflected in the Grid.
e.g.
1. Create three rows, with cells in Column B all set to "Isaac".
2. Grid correctly merges all cells in Column B into one.
3. Change Row one, Column B = "Joe Bloggs".
4. Grid still shows in merged cell of "Isaac".
Any ideas?
Thanks
Isaac
Hi Isaac,
What's your data source? It may not be sending notifications that the data has changed.
Or, it's possible that the grid just isn't re-merging the cells when it gets the notification, in which case this could be a bug.
Aha! Absolutely right. I'm using a DataSet for binding, which doesn't support (afaik) INotifyPropertyChanged. So I've manually called ResetCurrentItem on my BindingSource which fixes the problem - to a point.
The grid tries to redraw the merge cells, but leaves the "old" cell there as well, on top of the new one! The only way to fix this is to resize/ move the window, which seems to force the Grid to re-draw itself, and thus clearing the "old" cell.
So, the binding part works now, but it's uncovered something else in the redraw mechanism which seems to be flawed. Is there a way I can "force" the Grid to re-draw itself? i've tried calling the Invalidate and Refresh methods but neither do the trick.
Hi Issac,
isaacabraham said:Aha! Absolutely right. I'm using a DataSet for binding, which doesn't support (afaik) INotifyPropertyChanged.
No, this isn't right. The interface that the grid works with is IBindingList, not INotifyPropertyChanged. And the DataSet certainly does support it. So I'm not quite sure why this isn't working. It's good that you found a workaround, but it seems to me that you should not have to do this.
When the data changes in your data source, is the InitializeRow event of the grid firing? It should fire and it should then update the merged cells, in my opinion.
Instead of what you a currently doing, try calling grid.Rows.Refresh(ReloadData) and see if that helps.
Either way, I recommend submitting this issue with a small sample project that demonstrates the behavior to Infragistics Developer Support. It sounds like a bug to me. Get Help
Try:
grid.Rows.Refresh(RefreshRow.FireInitializeRow)
Mike Saltzman"]When the data changes in your data source, is the InitializeRow event of the grid firing? It should fire and it should then update the merged cells, in my opinion. Instead of what you a currently doing, try calling grid.Rows.Refresh(ReloadData) and see if that helps.
Hi,
When I call grid.Rows.Refresh(RefreshRow.ReloadData), the InitializeRow event is not firing. How can I force it?
The DataSource of the grid is assigned with a BindingSource initialized with a BindingList<>
When the grid is first initialized, the InitializeRow event works fine...
That worked - and removed the issue of the merged cell not presenting itself correctly.
Thanks very much.