I've a WPF application with a main grid with 4 rows.
I wont to bind the property MaxHeight
of the row(0) by XAML or code behind to the Height
value of the control inside.
The control inside row(0) is a ScrollViewer
and at run time, I add controls inside the SV.
I've tried with the XAML code:
<Grid Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="64" MaxHeight="{Binding Path=ActualHeight, ElementName=HeaderScrollViewer}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
And by code behind :
Grid.SetRow(Me.MainGrid, 0)
Me.MainGrid.MaxHeight = Me.HeaderScrollViewer.Height
Me.MainGrid.UpdateLayout()
But no luck...any suggestions?