title: Tabbed run unloaded event when change tab
body: <p>I have WPF form code like this (C#):</p>
  
  <pre><code>private void formSearch_Loaded(object sender, RoutedEventArgs e)
  {
      Publisher.dataUpdated += search;
  }
  
  
  private void formSearch_Unloaded(object sender, RoutedEventArgs e)
  {
      Publisher.dataUpdated -= search;
  }
  </code></pre>
  
  <p>When I open or change the tab to this form, <code>formSearch_Loaded</code> will run whenever I go to this tab / form, but when I change to the other tab <code>formSearch_Unloaded</code> will run automatically (basically in MDIstyle = "MDI" instead of MDIstyle = "tabbed" <code>formSearch_Unloaded</code> will run when the form closed).</p>
  
  <p>How can I run this <code>formSearch_Unloaded</code> event when the tab is closed (like when I used MDIStyle = "MDI") instead of tab changed?</p>