title: DrawingVisual is not refreshed
body: <p>I create my own <code>FrameworkElement</code> and override <code>VisualChildrenCount{get;}</code> and <code>GetVisualChild(int index)</code> by returning my own <code>DrawingVisual</code> instance. </p>
  
  <p>If I modify the content of the visual after initial rendering (e.g. in timer handler) using <code>DrawingVisual.RenderOpen()</code> and drawing into the context, the element is not refreshed.</p>
  
  <p>Here's the simplest sample:</p>
  
  <pre><code>using System;
  using System.Windows;
  using System.Windows.Media;
  using System.Windows.Threading;
  
  namespace VisualTest
  {
      public class TestControl : FrameworkElement
      {
          private readonly DrawingVisual _visual = new DrawingVisual();
  
          public TestControl()
          {
              Draw(false);
  
              var timer = new DispatcherTimer {Interval = new TimeSpan(0, 0, 2)};
              timer.Tick += (sender, args) =&gt;
                                {
                                    Draw(true);
                                    InvalidateVisual();
                                    timer.Stop();
                                };
              timer.Start();
          }
  
          protected override Visual GetVisualChild(int index)
          {
              return _visual;
          }
  
          protected override int VisualChildrenCount
          {
              get { return 1; }
          }
  
          private void Draw(bool second)
          {
              DrawingContext ctx = _visual.RenderOpen();
              if (!second)
                  ctx.DrawRoundedRectangle(Brushes.Green, null, new Rect(0, 0, 200, 200), 20, 20);
              else
                  ctx.DrawEllipse(Brushes.Red, null, new Point(100, 100), 100, 100);
              ctx.Close();
          }
      }
  }
  </code></pre>
  
  <p><code>InvalidateVisual()</code> does nothing. Although if you resize the window containing the element, it gets updated.</p>
  
  <p>Any ideas on how to properly refresh the content? Preferably <strong>without</strong> introducing new dependency properties for my element.</p>