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.
Here is the event handler
void closeTab_Click(object sender, RoutedEventArgs e)
{
Tabs.Items.Remove((MenuItem)sender);
}
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.
New problem:
void closeTab_Click(object sender, RoutedEventArgs e)
{
MenuItem close = (MenuItem)sender;
Tabs.Items.Remove(Convert.ToInt32(close.Name.Remove(0,3)));
}
The context menu item is named thusly:
Name = "Tab" + Tabs.Items.Count.ToString(),
It still does nothing