I have an UltraGrid control that I bind to a list of items to be displayed. I use the OutlookGroupBy option to group the items by a of property of the items. When I add items to my list and update the BindingSource nothing happens and I don't see the items appear in my grid.
Is this caused due to the fact that I have my items GroupedBy or do I need to call a specific method in order to see the new item(s) in the grid?
Hello dvanmil,
Most probably you would have to call the following method after changing your data in the DataSource in order to see the proper data in your UltraGrid:
ultraGrid1.DisplayLayout.Bands[0].SortedColumns.RefreshSort(true);
Where the bool "true" indicates that the data in UltraGrid groups will be regrouped.
Please let me know if this helps.
I got another problem now that I managed to get this. The items that I add form their own group (due to using the Outlook GroupBy). However, I want the newly added group to be expanded after it is added, but all other groups should retain their state as they currently are, so I can't call the Me.UltraGrid1.Rows.ExpandAll(False) command.
Since I don't know at what position the group will get added I can't really use the Me.UltraGrid1.Rows(index).Expanded = True command either. For some reason the setting e.Row.Expanded = True in the InitializeRow event doesn't result in an expanded group.
How do I solve this problem? Is there a way to obtain the index of the newly added group or is there an event that I can use to make sure that the newly added group expands when it is added?
Hi,
I don't think InitializeRow fires for GroupByRows. There's a separate event for InitializeGroupByRow.
So you could use that event. You will probably need to use some kind of flag to know when to expand the rows and when not to.
You could also just loop through the grid rows and find a GroupByRow with the Value from the row you added.
Thanks Mike,
your suggestion to use the InitializeGroupByRow event was spot in, this is exactly what I was looking for.