title: Binding Height from code behind
body: <p>I have a custom GridView like control made of a Grid panel with several controls in each row (All of them from System.Windows.Controls).</p>
  
  <p>The user requested that the row Height will grow unrestricted with the control's content. I'm having a problem to maintain the size of all the controls in each row with relation to the highest one.</p>
  
  <p>I'm trying to one-way bind the Height of all the controls in each row to the RowDefenition ActualHeight property. but it is not working as I expect it to work (Each control keeps it's own size to the minimum)</p>
  
  <p>Any help will be appreciated, thanks.</p>
  
  <p>Here is the code where I'm trying to bind:</p>
  
  <pre><code>                RowDefinition rowDef = new RowDefinition();
  
                  cellsGrid.RowDefinitions.Add(rowDef);
                  rowDef.Name = "gvRow" + cellsGrid.RowDefinitions.Count;
  
                  cellsGrid.Children.Add(controlToAdd);
                  Grid.SetRow(controlToAdd, rowIndex);
                  Grid.SetColumn(controlToAdd, columnIndex);
  
                  Binding bindH = new Binding("ActualHeight");
                  bindH.Mode = BindingMode.OneWay;
                  bindH.Source = rowDef;
                  BindingOperations.SetBinding(controlToAdd,RowDefinition.HeightProperty, bindH);
  
                  controlToAdd.TabIndex = (totalTabIndex + 1); totalTabIndex++;
                  cell.CellElement = controlToAdd;
                  cell.EndEdit += new GridViewCell.GridViewEditHandler(cell_EndEdit);
  </code></pre>