title: UI update in WPF elements event handlers
body: <p>There is a problem with UI update in WPF.</p>
  
  <p>I have such code:</p>
  
  <pre><code>    private void ButtonClick_EventHandler(object sender, RoutedEventArgs e)
      {
          Label.Visibility = Visibility.Visible;
          TextBox.Text = "Processing...";
  
          LongTimeMethod(); //some long operation
      }
  </code></pre>
  
  <p>The problem is that until LongTimeMethod ends (that is event handler ends), Label.Visibility and TextBox.Text will not be changed.</p>
  
  <p>I solved it like this so far:</p>
  
  <pre><code>    private void ButtonClick_EventHandler(object sender, RoutedEventArgs e)
      {
          Label.Visibility = Visibility.Visible;
          TextBox.Text = "Processing...";
  
          Dispatcher.BeginInvoke(new Action(LongTimeMethod), 
              DispatcherPriority.Background);
      }
  </code></pre>
  
  <p>Is there any other solution without using dispatcher invocation? Calling this.UpdateLayout() doesn't help.</p>