title: Windows Phone drawing ellipses
body: <p>Hello</p>
  
  <p>I want to draw 40 ellipses on one big ellipse. ITS STRANGE.</p>
  
  <pre><code>for (int i = 0; i &lt; 40; i++)
          {
              {
                  {
                      Random r = new Random();
                      int distance = r.Next(0, 10000);
                      var rv = r.Next(0, 359);
                      var x = Math.Sin(rv * Math.PI / 180) * 225;
                      rv = r.Next(0, 359);
                      var y = Math.Cos(rv * Math.PI / 180) * 225;
                      Ellipse e = new Ellipse();
                      e.Fill = new SolidColorBrush(Color.FromArgb(255, (byte)(counter * 5), (byte)(counter * 3), (byte)(counter * 1)));
                      e.Margin = new Thickness(y, -150 + x, 0, 0);
                      e.Width = 25;
                      e.Height = 25;
                      counter++;
                      PointsGrid.Children.Add(e);
                  }
              }
          }
  </code></pre>
  
  <p>This code draws only 7,8 or sometimes 9 ellipses. But if I add additional line to code:</p>
  
  <pre><code>for (int i = 0; i &lt; 40; i++)
          {
              {
                  {
                      Random r = new Random();
                      int distance = r.Next(0, 10000);
                      var rv = r.Next(0, 359);
                      var x = Math.Sin(rv * Math.PI / 180) * 225;
                      rv = r.Next(0, 359);
                      var y = Math.Cos(rv * Math.PI / 180) * 225;
                      Ellipse e = new Ellipse();
                      e.Fill = new SolidColorBrush(Color.FromArgb(255, (byte)(counter * 5), (byte)(counter * 3), (byte)(counter * 1)));
                      e.Margin = new Thickness(y, -150 + x, 0, 0);
                      e.Width = 25;
                      e.Height = 25;
                      counter++;
                      PointsGrid.Children.Add(e);
                      MessageBox.Show(""); // Additional line
                  }
              }
          }
  </code></pre>
  
  <p>If i add showing messageboxes, press ok on all of them, I will see all 40 ellipses...</p>
  
  <p>The question is how could it be and how can i fix it ?</p>