I have a multi band grid where a child band has only a subset of the parent band's columns.
What I'd like to do is to have a child band's columns appear under matching parent band's columns.
I'd like to know what the best approach might be in accomplishing this.
My initial thinking is that I'd create kind of dummy columns for the missing columns in the child band then use DrawFilter to NOT draw those columns. I guess then the question might be whether I create the dummy columns by creating those columns manually or create them by creating dummy properties on the business object itself.
Is there an easier way to accomplish this behavior?
Hi,
I don't know of any other way to do this besides adding extra columns. I'd add the columns to the grid, rather than to do the data source, since they have no meaning in the data source, itself.
Using a DrawFilter for this will be a bit tricky. You can actually get most of the way to where you need by simply using the InitializeRow event and setting the Hidden property on the cells of the "fake" columns. That will prevent the cells from drawing without having to use a DrawFilter.
The problem is that you will still see the row background (which may not be a problem) and borders. There's really no way to DrawFilter those out, since the entire border of the row is drawn in one operation. You would have to draw over the borders in those place where you want to erase them.
Or... maybe you could just set BorderStyleRow to None. That might work, since the cells will draw borders, anyway.
So the only thing you would need a DrawFilter for in that case would be to prevent the drawing of the headers. But... if you use RowLayouts, you could set the LabelPosition on the fake columns to None and that might work.
Thanks MiKe, adding the columns and setting the cell.Hidden got me most of the way.
I then changed the following:
childBand.HeaderVisible = false
childBand.ColHeadersVisible = false
childBand.Override.BorderStyleRow = None
childBand.Override.RowSelectors = false
childBand.Override.RowAppearance.BackColor = Transparent
childBand.Override.CellAppearance.BackColor = Window
childBand.Override.CellAppearance.BorderColor = DarkGray
With those changes, my child band looks perfect aligned below the parent band with matching style and everything.
The only thing is there is a doubling of the border where the child band's cell bottom border meets the next parent band's top border. Is there some margin property somewhere that can give it some space? But only apply when there is a child band expanded?