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
210
Can I display space between columns
posted

I was wondering if it was possible to display space in between columns, similar to this picture:

Thanks,

Brad

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Brad,

    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.

Children