开发者

Height of Last row in a wpf grid control

I have a grid like this

<Grid.RowDefinitions>
    <RowDefinition Height="Auto" MinHeight="100"/>
    <RowDefinition Height="Auto" MinHeight="100"/>
    <RowDefinition Height="Auto" MinHeight="100"/>
    <RowDefinition Height="Auto" MinHeight="100"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" MinWidth="210" />
    <ColumnDefinition Width="Auto" MinWidth="210"/>
    <ColumnDefinition Width="Auto" MinWidth="210"/>
</Grid.ColumnDefinitions>

When I resize the Grid, I found that the actual heigh开发者_JAVA技巧t of the last row always remains 100, assuming there is no control inside. So the problem is even if the Grid height is, for example, 450 the actual height still remains 100 for the last row.

I know I can get the height of last row by subtracting the heights of the other rows from the Grid actual height. But why is the actual height of the last row is not getting updated when the Grid is being resized?


You are saying the last row should determine it's height based on the elements in it, but be no smaller than 100 pixels tall. If there are no elements in the last row, then it would normally be 0 pixels high without the MinHeight.

Sounds like you want to use:

<RowDefinition Height="*" MinHeight="100" />

for your last row.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜