I have a multiband grid where a child band is bound to a bindinglist. The list can be empty. I set the ExpansionIndicator on the parent band to CheckOnDisplay so that the indicator only appears if there are any items in the list.
Is it possible to also automatically expand the parent band when the indicator appears?
Mike Saltzman"] In that case, you might be able to do something more efficiently, by handling the AfterRowRegionScroll event and looping through only the grid.ActiveRowScrollRegion.VisibleRows collection and expanding the rows that are visible on the screen. The only problem with this is that expanding a row might cause the grid to scroll, your code might have to use the EventManager to prevent recursion.
In that case, you might be able to do something more efficiently, by handling the AfterRowRegionScroll event and looping through only the grid.ActiveRowScrollRegion.VisibleRows collection and expanding the rows that are visible on the screen. The only problem with this is that expanding a row might cause the grid to scroll, your code might have to use the EventManager to prevent recursion.
Worked great, thanks for the suggestion.
I'm afraid I'm a loss to explain this. If expanding the row in the ListChanged event works, then that would seem to indicate that something in your code is causing a ListChanged to get called after the row has been expanded and that this is therefore causing the rows to collapse. For example, if you are doing something that causes the data source to send a Reset notification, the grid will throw away all rows and create a whole new set of rows because it has to show the new data. But... if that were the case, then InitializeRow would be firing again, so the rows should re-expand. Unless maybe you have a flag or some condition that only expands the rows once.
For now, the only way to make it working is using this approach:
myList= new BindingList<PayoutPartDto>(); myList.ListChanged += (obj, args) => { myGrid.Rows.ExpandAll(true); };
So every time I change the binding source of the grid, by adding, removing or updating a row, the grid is expanding again the rows.
I think that the problem is not really related to the grid but more to the BindingList itself.
What do you think?
It's hard to give you any advice without more information. If expanding the row in the InitializeRow event doesn't work, then either there are no child rows when that event is firing, or else something is re-collapsing the row after you expanded it.
Those are the only two reasons I can think of why this would not work.
Hi guys, I have the same exact problem but with me this solution doesn't work.
I tried also the expand all and it doesn't work too.
I have a simple binding list that I setup in the constructor of the form as the datasource of the grid and then I play with it and the grid is giving me the expected data but the rows are always not expanded.
I tried to hook the initialize grid row event and the initialize layout setting both grid.rows.expandall(true) or e.row.expanded = true but it doesn't work.
Any suggestions?