title: C# Metro app - adding controls to specific row and column in grid
body: <p>I want to create some control object (<code>Windows.UI.Xaml.Shapes.Rectangle</code> to be specific) and add it programmatically to <code>Grid</code> control, which is created in designer. I've searched a lot and I didn't find what I need - many answers said about <code>SetRow</code> and <code>SetColumn</code> methods. The problem is that, apparently, those functions just don't exist in new XAML (<strong>edit:</strong> <code>Grid</code> I'm talking about is in namespace <code>Windows.UI.Xaml.Controls</code>, not in <code>System.Windows.Controls</code>).. I've tried adding control as a children to grid:</p>
  
  <p><code>grid.Children.Add(Rectangle);</code></p>
  
  <p>The control is added in the center of a first row/first column cell in <code>Grid</code>, which is pretty logical, but how to add next <code>Rectangle</code> into first row and i.e. second column?</p>
  
  <p>Here's some actual code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public void Draw(ref Grid grid)
  {
      Color rectColor = new Color()
      {
          R = 90,
          G = 90,
          B = 90,
          A = 255
      };
  
      Brush rectBrush = new SolidColorBrush()
      {
          Color = rectColor
      };
  
      Square = new Rectangle()
      {
          Fill = rectBrush,
          Height = 40,
          Width = 40
      };
  
      grid.Children.Add(Square);
  }
  </code></pre>
  
  <p>Above method is of course part of bigger program, but when I finally manage to fit one control into one cell described by row and cell number, I guess it'll be simple to make it for the rest (I need 15x15 board).</p>
  
  <p>Last thing - as I've noticed, all these <code>Grids</code> and other layout-controls don't seem to work as tables, so my approach may be completely wrong. When controls is added directly in designer, it just automatically fits into right row and column. So, should I somehow only arrange children controls in <code>Grid</code>?</p>
  
  <p>Sorry, if this question is trivial, I just have no idea, how to do that, I'm trying like two days, so I'll be very grateful for any advices.</p>