title: How to prevent tab item selection change event?
body: <p>I am working on a wpf .My requirement is to change selection of tab  according to user confirmation it means every time when user changes tab a message box opens and confirm with user whether he wants to change the tab or not.</p>
  
  <p>But problem with me is when I press no first time it works fine .but after that on second time  it asks two times for user confirmation</p>
  
  <p>can anyone help me to solve this ?</p>
  
  <pre><code>private void tabcontrol_SelectionChanged(object sender,SelectionChangedEventArgs e)
  {
      try
      {
      if (handleSelection  &amp;&amp; e.OriginalSource == tbUserProfileMainControl)
          {
           //Ask user for change
  
           if (isUserAllowedToChanged)
               {
               int currentIndex = (tabcontrol.SelectedIndex);
  
               GeneralDeclaration.currentSelectedTabIndex = currentIndex;
  
               LoadUserControl(GeneralDeclaration.currentSelectedTabIndex);
               }
           else
               {
               //e.Handled = true;
               handleSelection = false;
               tbUserProfileMainControl.SelectedIndex = Math.Abs(tbUserProfileMainControl.SelectedIndex - 1);
                }
           }
     handleSelection = true;
     }
     catch (Exception ex)
         {
          //
         }
  }
  </code></pre>