Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
410
automatically expand a band when collection changes?
posted

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?

Parents
  • 469350
    Suggested Answer
    Offline posted

    If you have a reasonably small number of rows in the grid, then I would use the InitializeRow event and simply set e.Row.Expanded = true. That will expand every row as it is initialized.

    Another option could be to call grid.Rows.ExpandAll immediately after setting the grid's DataSource.

    If your data set is large, though, both of these approaches may cause a performance issue, since retrieving child rows from a DataSet can be a costly operation.

    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.

Reply Children
No Data