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:
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.