title: How to set Grid row and column positions programmatically
body: <p>I have two Grids inside a Stackpanel.
  The first grid is named as GridX.
  Initially, inside the grid, there is a 2D array of Textboxes(RowDefs/ColumnDefs).
  The TextBox definition in XAML is</p>
  
  <pre><code>&lt;TextBox x:Name="A1" Grid.Row="4" Grid.Column="5" TextAlignment="Center" /&gt;
  </code></pre>
  
  <p>I want to add a <strong>TextBlock</strong> programmatically in the same position as part of GridX.</p>
  
  <p>The effect must be like this</p>
  
  <pre><code>&lt;TextBlock Grid.Row="4" Grid.Column="5"
  HorizontalAlignment="Left" VerticalAlignment="Top" Text="10" FontSize="8"/&gt;
  </code></pre>
  
  <p>How to add this.
  I have tried this:</p>
  
  <pre><code>TextBlock tblock = new TextBlock();
  GridX.SetColumn(tblock, cIndex);
  GridX.SetRow(tblock, rIndex);
  </code></pre>
  
  <p>But failed.</p>
  
  <p>Again I tried this:</p>
  
  <pre><code>int rIndex = Grid.GetRow(txtBox);
  int cIndex = Grid.GetColumn(txtBox);                               
  
  TextBlock tblock = new TextBlock();
  tblock.VerticalAlignment = VerticalAlignment.Top;
  tblock.HorizontalAlignment = HorizontalAlignment.Left;
  tblock.FontSize = 8;
  tblock.Text = rc[i, j - 1];
  
  Grid.SetColumn(tblock, cIndex);
  Grid.SetRow(tblock, rIndex);
  
  txtBox.MaxLength = 1;    
  </code></pre>
  
  <p>Now the problem is that TextBlock is not visible. TextBox hides it.
  I appreciate your help.                       </p>