title: Adding children to stackpanel programmatically not working
body: <p>Can anybody spot the mistake that I am doing?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>        StackPanel stackPanel = new StackPanel();
          stackPanel.Orientation = Orientation.Vertical;
          for (int index = _elements.Count - 1; index &gt;= 0; index--)
          {
              FrameworkElement element = _elements[index];
              WriteableBitmap tempBitmap = new WriteableBitmap(element, null);
              Image image = new Image();
              image.Source = tempBitmap;
              stackPanel.Children.Add(image);
          }
  
          stackPanel.UpdateLayout();
  
          _bitmap = new WriteableBitmap(stackPanel, null);
  
          _bitmap.Invalidate();
  </code></pre>
  
  <p>As you can see I am creating a temporary Image and then adding it to stackpanel and then creating a final WriteableBitmap. Myy 1st children of stackpanel is of height 154 and 2nd one is of 389. After this line:</p>
  
  <pre><code> _bitmap.Invalidate();
  </code></pre>
  
  <p>when I see PixelHeight it is just 389. Where did my 1st child go?</p>