// Button Close Click - Remove the Tab - (or raise an event indicating a "CloseTab" event has occurred) void button_close_Click(object sender, RoutedEventArgs e) { Wpf.Window3 tableDialog = new Wpf.Window3(); tableDialog.ShowDialog(); if (tableDialog.yesButton) { ((TabControl)this.Parent).Items.Remove(this); } }