private void tabs_TabClosing(object sender, CancelSourceEventArgs e) { if (!_closing) { _closing = true; C1TabItem tabItem = (C1TabItem)e.Source; e.Cancel = true; MessageBoxResult result = MessageBox.Show("Do you really want to close this tab?", "Close Tabs?", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { c1Tab.Items.Remove(tabItem); } _closing = false; } }