title: WPF - First datagrid of two, max height
body: <p>I am trying to create a UserControl that can be use like a frozingDatagrid for row (cause there is no one by default). My UserControl is basic :</p>
  
  <pre><code>&lt;UserControl ..&gt;
     &lt;Grid&gt;
         &lt;Grid.RowDefinitions&gt;
             &lt;RowDefinition Height="auto" /&gt;
             &lt;RowDefinition Height="*"/&gt;
         &lt;/Grid.RowDefinitions&gt;
  
         &lt;Datagrid Name="Frozen" Grid.Row="0" MaxHeight="{Binding Height, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type UserControl}}}" ... /&gt;
         &lt;Datagrid Name="Normal" Grid.Row="1" ... /&gt;
     &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>I want the scroll option only for the Normal datagrid, except if the Frozen datagrid height exceed the height of the user control. For now the Frozen datagrid his expend for all items he contains.</p>
  
  <p>EDIT :</p>
  
  <p>I am able to get the result you have with your example.</p>
  
  <p>But when i resize my window smaller if the frozen part become cut and no scroll bar appear. I thought that put MaxHeight property would be good, but its like the style apply before the control is generate on screen so UserControl doesn't have a heigth. So its set MaxHeight to NaN and my datagrid is longer then my control so I miss data.  </p>
  
  <p>Thanks</p>