Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8150965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:13:16+00:00 2026-06-06T15:13:16+00:00

This question is hard to describe succinctly, so bear with me. Currently I have

  • 0

This question is hard to describe succinctly, so bear with me.

Currently I have a Grid with two rows. The first row’s height is Auto, and the second row’s height is *, so when I resize the window, the second row grows and shrinks according to the window.

This is the basic layout:

<Window>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Border>
            ...
        </Border>
        <Border Grid.Row="2">
            ...
        </Border>
    </Grid>
</Window>

Here is a poor sketch of the existing behaviour:

____    ____    ____
     ->      ->
____    ____    ____
                ____
        ____
____

I would like to add a sort of ‘minimum height’ to the second row, so that when I resize the window small enough, the second row stops shrinking, and the first row starts shrinking instead.

Desired behaviour:

____    ____    ____
     ->      -> ____
____    ____
                ____
        ____
____

Is there a simple way to get the minimum height for the second row, and force the first one to shrink?

More details:

When I set MinHeight on the second row, it just clips the grid when I resize it below that size.

The size of the controls in the first row are unknown at compile time, but known at runtime. If it is a necessary part of the solution, I could set the row’s MaxHeight, but right now an Auto height is working.

The controls in the second row do not have an explicit size. They are allowed to be resized, but I’m trying to keep them from becoming smaller than the desired minimum height.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:13:18+00:00Added an answer on June 6, 2026 at 3:13 pm

    The size of the controls in the first row are unknown at compile time, but known at runtime. If it is a necessary part of the solution, I could set the row’s MaxHeight, but right now an Auto height is working.

    I think this is probably going to be the easiest solution. Bind the MaxHeight to the calculated value at runtime:

    <Grid.RowDefinitions>
        <RowDefinition Height="*" MaxHeight="{Binding MyProperty}"/>
        <RowDefinition Height="*" MinHeight="100"/>
    </Grid.RowDefinitions>
    

    Edit: The previous solution is close, but not correct. Here is a way to achieve your desired result, however, not sure if it’s the optimal approach:

    <Grid ShowGridLines="True" Name="myGrid">
        <Grid.Resources>
            <local:RowHeightConverter x:Key="rowHeightConverter" />
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Name="row1" MaxHeight="{Binding MyProperty}">
                <RowDefinition.Height>
                    <MultiBinding Converter="{StaticResource rowHeightConverter}">
                        <Binding Path="ActualHeight" ElementName="row2" />
                        <Binding Path="ActualHeight" ElementName="myGrid" />
                        <Binding Path="MaxHeight" ElementName="row1" />
                    </MultiBinding>
                </RowDefinition.Height>
            </RowDefinition>
            <RowDefinition Name="row2" Height="*" MinHeight="300"/>
        </Grid.RowDefinitions>
    </Grid>
    

    And your converter:

    public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        double row2Height = (double)values[0];
        double gridHeight = (double)values[1];
        double row1MaxHeight = (double)values[2];
    
        if (gridHeight - row2Height >= row1MaxHeight)
        {
            return gridHeight - row2Height;
        }
    
        return row1MaxHeight;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for the vague thread title; hard to succinctly describe my question. I have
It's hard to summarize this question into one sentence. I have two tables -
This question is hard to phrase, so I'm going to have to use some
This is kind of a hard question to describe, and I've searched for about
As this question is hard to describe, that's the best title i could come
I have a question about Ruby arrays but it's kind of hard to describe
I wasn't entirely sure how to title this question, it's hard to describe what
i have searched the whole internetz for this question, and its a damn hard
This question is more UI/Design-ish than hard-core programming is. Background: I've been coding in
Referring to this question: https://stackoverflow.com/questions/2035449/why-is-oop-hard-for-me class Form { protected $inputs = array(); public function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.