Reputation: 48522
In my window, I have a grid with two rows. In the first row I have a tab control. In the second row I have a row of buttons. I would like the second row to have a height of roughly 30. I would like the first row to consume the rest of the available height.
As the user resizes the grid vertically, I would like the second row to stay fixed at 30 and move with the vertical resize. I would like the first row to shrink or grow in proportion to the vertical resize.
As an example, say my window has an initial height of 800. My second row would be fixed at 30 and my first row would consume the difference (~770). Now say the user resizes the window vertically and decreases the total height to 600. I still want to see all my second row at 30, but my first row would shrink to ~570.
What do I set my grid row definitions at to accomplish this? I cannot seem to get it right.
Upvotes: 3
Views: 3970
Reputation: 351
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
</Grid>
Upvotes: 1
Reputation: 30840
Set height of second row to 30 and height of first row to *.
Also, instead of fixed height for second row, use Auto to allocate auto height.
Also, learn the star sizing of grid in WPF.
Upvotes: 3
Reputation: 4502
Set first row's height to "*"
(in xaml) and the second row's height to "30"
.
Upvotes: 3