title: add elements to WPF Grid
body: <p>I wanted to make a function that populates a Grid in WPF with pictures. So I did that:</p>
  
  <pre><code>private void setCellImage(Grid g, Image img, int column, int row)
  {
  
      Grid.SetColumn(img, column);
      Grid.SetRow(img, row);
  
      if (!g.Children.Contains(img))
          g.Children.Add(img);
  
      g.UpdateLayout();
  }
  </code></pre>
  
  <p>And was using it by calling in that way:</p>
  
  <pre><code>for (int i = 0; i &lt; 15; i++)
      for(int j=0; j&lt;15; j++)
          setCellImage(gameMap,background, i, j);
  </code></pre>
  
  <p>But it wasn't working. it populated a grid only in cell 14,14 leaving all other cells blank.</p>
  
  <p>I thought that it may be my  mistake that I should use another instances of Image but it wasn't that: </p>
  
  <pre><code>private  void setCellImage(Grid g, Image img, int column, int row)
  {
      Image _img = new Image();
      _img = img;
  
      Grid.SetColumn(_img, column);
      Grid.SetRow(_img, row);
  
      if (!g.Children.Contains(_img))
          g.Children.Add(_img);
  
      g.UpdateLayout();
  }
  </code></pre>
  
  <p>This thing is still not working.</p>