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
150
Hide second line if empty when using RowLayout with two lines
posted

Hi,

I rarely ask questions, but I have been struggling with this for several hours, and I am sure you can help me.

I am using a simple RowLayout with 3 fields in the first line (OriginY = 0), except a "Comments" field which is on the second line (OriginY = 1) and spans 3 fields.

What I would like is for the comments line to only show when actual comments exist.

So I am trying to make the second line to be 0 or 1 pixels in height as the minimum by setting the preferredcellsize of the Comments cell to (1,1).

But it still displays the full height Comments line even when no text is in it.

What would be property or properties I need to set to make this happen?

Parents
  • 23930
    Suggested Answer
    Offline posted

    Hi,

    Thank you for posting in our forums.

    If the cell you want to hide is at the bottom of the row, you can use the InitializeRow event to hide the cell. First you will need to set the MinRowHeight property to 1 and then the RowSizing property to Free. This will allow to set the row height to whatever positive number you want and each row can have its own height. After that in the initialize row event if the comment cell has no value, reduce the Height of the row so that only the top level cells are displayed.

    I have attached a sample which demonstrates this suggestion.

    Please let me know if you have any additional questions.

    WG_RowLayoutsDisplayCellIfItHasContent.zip
Reply Children