I was wondering if it was possible to display space in between columns, similar to this picture:
Thanks,
Brad
Hi Lucian,
What I ended up doing was creating a column within my dataset that had no data, and made it a disabled column. Then within the grid_InitializeRow event I set
e.row.cells("BlankCol").Appearance.BackColorDisabled to the background color of my form Infragistics.Win.MicrosoftColorTable.Office2007ColorTable.Colors.TabSelectedGradientLight.
Hello Brad,
Did you succeeded to set the background to a hidden cell?
Lucian
Hi Brad,
It's probably not the form. My guess is that you are seeing the BackColor of the row. So perhaps what you need to do is something like this in the InitializeLayout event:
e.Layout.Override.RowAppearance.BackColor = Color.Transparent;
Or maybe use the same color as the grid background instead of Transparent.
Thanks Mike,
Setting e.Row.Cells("colname").hidden did work... mostly. However when I do this the column's color become the same color as my form, not the background color of the grid itself.
How can I make it so that the column has the same background color as the grid?
Yes and no. :)
There's no easy way to do this with a simple property setting. But it can be done.
What I would do is add an unbound column into the grid. You could do this in the InitializeLayout event and set the column.Header.VisiblePosition property to place the column where you want it.
Now all you have to do is hide the column. But you can't use the column's Hidden property, because if you do that, the grid will reclaim the space. So you have a couple of options from here.
One approach you could take is to hide the cells. You would handle the InitializeRow event and set e.Row.Cells["My Unbound Spacer Column"].Hidden to true.
If you do that, you will end up with a header and you will still see the row borders, but it gets you most of the way there.
To get rid of the header, you could set the Caption to a single space character. This does not remove the headers, but it leaves you with a blank header and no cells.
If you really want to eliminate the header completely, you could turn on RowLayouts for the band and then set the column.RowLayoutColumnInfo.LabelPosition to None. But using RowLayouts could have other implications for you app that you may not want. For example, you can't use RowLayouts and have Fixed columns - the two are mutually exclusive.
If you want to get it to look exactly like you have in this screen shot, then I would still recommend the unbound column approach. Then you could use a CreationFilter to prevent the creation of the HeaderUIElement and the CellUIElements. This would leave you with just the problem of the row borders. To handle that, you could use the CreationFilter to create a new UIElement with a solid background color and cover up the borders. So it would require some work, but I beleive it's possible.