❔ Dynamic sizing of Grid Rows
I am faced with a UI problem in WPF and looking for some ideas on how to deal with it:
I have a grid with 3 rows. a row contains a DataGrid that can be visible or not depending whether it has data. I want to size the rows dynamicly, in respect to how many grid rows have data - that is when there is only one row it shall take full height, when its 3 it should be commonly distributed etc.
My initial approach would be to set the height of these rows to
*
which will use dynamic sizing in respect to available space and then add or remove rows to grid in the code-behind. I'm just concerned whether this is a good idea because I can imagine that adding and removing rows to a grid at runtime costs a lot.
I could also always use 3 rows and just change the height of those that are empty to 0
tho.
those are the two ideas I have. What do you guys think?1 Reply
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.