title: How to change the background color of border after one second in WPF?
body: <p>I click the button background of border is blue, after one second it should be red. It is red  but not blue. Why? </p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Window1" Height="300" Width="300"&gt;
      &lt;Border Width="111" Name="op" Height="111"&gt;
          &lt;Button Name="opbtn" Click="opbtn_Click" Width="50" Height="23"&gt;click&lt;/Button&gt;
      &lt;/Border&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Code-behind:</p>
  
  <pre><code>private void opbtn_Click(object sender, RoutedEventArgs e)
  {
      op.BorderBrush = System.Windows.Media.Brushes.Blue;
      DateTime obj1 = new DateTime(); 
      DateTime obj2 = DateTime.Now.AddMilliseconds(200);
      while (obj2 &gt; obj1)
      {
          obj1 = DateTime.Now;
      }
      op.BorderBrush = System.Windows.Media.Brushes.Red;
  }
  </code></pre>