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
630
Ability to set height of wingrid cell to hide it
posted

We have a situation where we are using a GroupLayout for a Wingrid where we would like to hide a cell when it does not have any text in it.

I've attached a .png file that shows how things look now and how we would like them to look.

So essentially the last cell in this group layout spans all the columns above it. So in a sense this cell is acting like a row. To save space we would like to hide this cell when it does not contain any text.

We've experimented with setting the ActualCellSize with no success.

e.Row.Cells("StatusMessage").Band.Columns("StatusMessage").RowLayoutColumnInfo.ActualCellSize = New Size(1380, 0)

Is what we are attempting even possible? And if so, how should we go about doing this?

Thanks,

Jim

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Jim,

    This is not easy to do, but I was able to make it work.The autosizing of the rows will not remove the space because it doesn't know you want that and there's really no way to tell it. It assumes that you want to show the empty cell, which is a reasonable assumption.

    The way I got it working is to set the height of the row to the height of one of the cells in the top row. This won't work unless you also set the MinRowHeight or else the grid will stop you from making the rows that small.

    I am attaching a small sample project that demonstrates how I did it.

    MemDataTable CS 2010.zip
Reply Children
No Data