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 1113777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:54:26+00:00 2026-05-17T02:54:26+00:00

I have a recursively defined user control that needs the following properties: there are

  • 0

I have a recursively defined user control that needs the following properties:

there are two columns

the first contains a single border around some text

the second column contains a stack of these same type of controls (the recursive part)

if the box in the first column is shorter than the total height of the stacked boxes in the second column, the box should expand to make both columns the same height.

If the total height of the second column is shorter than the box in the first column, then the last item in the second column’s stack should expand so they are the same height.

so for example, it might look like this:

alt text

Ok, so far what I have done is create a horizontal stack panel where the first item is a dock-panel containing a border and text… the second column is a vertical stack panel bound to a sublist, creating the recursive user control… like this..

<StackPanel Orientation="Horizontal" Background="AliceBlue">
        <local:TMRequirementView Requirement="{Binding Baseline}" />
        <StackPanel Orientation="Vertical">
            <ItemsControl ItemsSource="{Binding Requirements}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <local:TMGridView Baseline="{Binding}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>

Where the requirement looks like this:

    <DockPanel>
        <Border MinHeight="50"
                BorderBrush="Black" BorderThickness="2">
            <TextBlock Text="{Binding Description}" 
                       TextWrapping="Wrap" Background="Transparent" Height="Auto" />
        </Border>
    </DockPanel>

Now this works great if the stacked column is taller, but it doesn’t work if the first column is taller, and I get gaps. Any idea how to handle this mutual height dependency?


Update:
So by adding a border around the right columns stack panel, I was able to see that the stackpanel actually did receive the min-height changes. However, even though there was room to expand, the children of the stack panel didn’t automatically update. If I fix the minheight of the stack panel before hand to something large, the children fill up. What I need to figure out is how to update the chidren’s height based on changes to the stack panel’s min-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-05-17T02:54:26+00:00Added an answer on May 17, 2026 at 2:54 am

    I think the Grid in this layout does what you describe. I put it in a DockPanel so that you can see how it resizes. Try typing stuff into the text boxes and watch how it behaves:

    <Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
      <DockPanel>  
        <Grid DockPanel.Dock="Top">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
          </Grid.RowDefinitions>
          <TextBox AcceptsReturn="True" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3"></TextBox>
          <TextBox AcceptsReturn="True" Grid.Row="0" Grid.Column="1"></TextBox>
          <TextBox AcceptsReturn="True" Grid.Row="1" Grid.Column="1"></TextBox>
          <TextBox AcceptsReturn="True" Grid.Row="2" Grid.Column="1"></TextBox>
        </Grid>
        <TextBlock/>
      </DockPanel>
    </Page>
    

    All three rows of the Grid will have the height of a TextBox at a minimum (when you replace the TextBoxes with other elements, you’ll need to set minimum heights to keep them from vanishing if they’re empty). Since the third row is star-sized, it will size itself to all remaining vertical space left after the first two rows are arranged. So if there’s a bunch of content in the first column, the third row in the second column gets taller.

    Edit

    Actually, there’s no reason to even screw around with a Grid in this case: What you’re describing is really the behavior of the DockPanel:

    <DockPanel>
      <DockPanel DockPanel.Dock="Top">      
        <DockPanel.Resources>
          <Style TargetType="Label">
            <Setter Property="DockPanel.Dock" Value="Top"/>
            <Setter Property="Background" Value="Lavender"/>
            <Setter Property="Margin" Value="1"/>
          </Style>
        </DockPanel.Resources>
        <DockPanel LastChildFill="True">
          <Label>Foo</Label>
        </DockPanel>
        <DockPanel LastChildFill="True">
          <Label>Foo</Label>
          <Label>Bar</Label>
          <Label>Baz</Label>
          <Label>Bat</Label>
        </DockPanel>
      </DockPanel>
      <Label/>
    </DockPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that occasionally needs to scan some directories recursively (an improvement
I have to rename a complete folder tree recursively so that no uppercase letter
I have a need to evaluate user-defined logical expressions of arbitrary complexity on some
I have some code that has to compile for multiple platforms. The following will
I have defined an ajax dataFilter for my jQuery calls that return JSON data
I have the following very simplistic implementation for a single linked list in C:
Ok so I have an array that holds the following elements: $array['a']['b'][0]['c']; $array['a']['b'][1]['c']; $array['a']['d'][0]['c']['c'];
I have an Account model that has_one User model, and a User model that
In the Fibonacci sequence, I have seen conventional implementations which recursively call the same
Have you ever seen any of there error messages? -- SQL Server 2000 Could

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.