I have grid panel 16 x 4 like this one:
Sometimes i want to hide some rows and to move bottom rows up. When I set component visible property to false the layout is not updated:
Nevertheless the row size type is set to auto:
Why the component don't set row height to zero when there is nothing to display?
Why the component don't set row height to zero when there is nothing to display ?
Because the row is considered as empty only if there are no components in all columns in that row, not if they're visible or not. So the same returns the
IsRowEmpty
method. To workaround this, you'd need to be notified by the cell component about its visibility change. When this notification is generated, you can check the row just like theIsRowEmpty
method does, except you'll check if the controls are visible, not if they're assigned. Based on the result of such method, you can then set the size of theValue
to 0 to hide the row.With a help of interposed class, the method for checking if all controls in a row or column are visible, you might write something like this. Those methods return True, when all existing controls in a certain row or column are visible, False otherwise:
And the usage shown for the first row: