Controls (Labels) in CPU-intensiven Schleifen aktualisieren.

// Update, refresh, invalidate controls (Textbox, Label)

public static class ExtensionMethods
{
   private static Action EmptyDelegate = delegate() { };

   public static void Refresh(this UIElement uiElement)
   {
      uiElement.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
   }
}

private void Loop()
{
   for (int i = 0; i < 5; i++)
   {
      label1.Content = i.ToString();
      label1.Refresh();
      Thread.Sleep(1000);
   }
}