title: Closing/Removing a tab item WPF
body: <p>I have a tab control in a window. The tabs all have simple context menus which (are supposed to) allow the user to close them. However, when I click close, nothing happens.</p>
  
  <p>Here is the event handler</p>
  
  <pre><code>void closeTab_Click(object sender, RoutedEventArgs e)
  {
      Tabs.Items.Remove((MenuItem)sender);
  }
  </code></pre>
  
  <p>I've looked around about closing tabs, but none of the articles I found went into much detail about how to actually close the tab.</p>
  
  <p>New problem:</p>
  
  <pre><code>void closeTab_Click(object sender, RoutedEventArgs e) 
  { 
      MenuItem close = (MenuItem)sender; 
      Tabs.Items.Remove(Convert.ToInt32(close.Name.Remove(0,3))); 
  } 
  </code></pre>
  
  <p>The context menu item is named thusly: </p>
  
  <pre><code>Name = "Tab" + Tabs.Items.Count.ToString(), 
  </code></pre>
  
  <p>It still does nothing</p>