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
195
Cloning Bands
posted

I'd like to be able to add bands to an UltraGrid dynamically. To do this I'd like to clone existing bands so that the new bands have the same columns and appearance. I'd like to do this so that I can:

1) customize the appearance of each band's header to add information related to the rows in the band

and 2) quickly and easily hide or show bands.

I currently have 3 bands. Two are children of the first band. They're bound to a dataset with three tables and two tables are related to a parent table. With this arrangement I can't change the appearance of the headers for each group of child rows that appear when I expand the grid to show the rows related to each parent row. I also can't quickly hide the rows related to a single parent row without leaving the header displayed. I think I can accomplish what I want if I create new bands dynamically to contain only the rows related to a parent row.

It looks like the web grid has a way to clone bands but I'm in a Windows form not a web browser. Any suggestions will be appreciated.

Thanks,

Tom

  • 469350
    Offline posted

    Hi Tom,

    Tom said:
    I'd like to be able to add bands to an UltraGrid dynamically.

    The grid's bands are determined by the DataSource. So you cannot add a band to the grid - you have to add it to the DataSource and then the grid will display it.

    There's no way to clone a band. You would essentially have to examine the original band and copy each property to the new band individually. The only exception to this would be RowLayouts. You can save the band's RowLayout and apply the same layout to another band, assuming that both bands have the exactly same columns, but this is just the layout, it does not include appearances.

    Tom said:
    With this arrangement I can't change the appearance of the headers for each group of child rows that appear when I expand the grid to show the rows related to each parent row.

    I'm not sure I quite follow what you are getting at here. But it sounds like maybe what you want to do is change appearance of the same column header under different parents. So in other words, you have two parent rows and you want the child band headers under the first parent row to have a different appearance and possibly different text than the child band headers for the same band under the second parent row.This is not possible to do with property settings, since it's the same column and the same band under each parent row. But this is possible to do using a CreationFilter (to change the text) and a DrawFilter (to change the appearance).

    Tom said:
    I also can't quickly hide the rows related to a single parent row without leaving the header displayed.

    If there are no child rows for a particular band under a particular parent row, then the grid does not display the headers. But I'm not sure if the same things applies when there are child rows, but they simply are not visible. If that's the case, then you might be able to achieve what you want here by filtering the rows out of the DataSource instead of hiding them in the grid.