private void CommandBinding_Executed_DF(object sender, ExecutedRoutedEventArgs e) { RichTextBox rtb = ((RichTextBox)tabControl.SelectedContent); TabItem tabitem = (TabItem)tabControl.SelectedItem; if (rtb != null) { tabitem.Content = null; myDf = new DF(rtb); myDf.Show(); myDf.Focus(); btnCloseTab_Click(sender, e); } else { MessageBox.Show("You need to have at least 1 file open to edit it in distraction free mode.", "Warning", MessageBoxButton.OK, MessageBoxImage.Information); } }
public void DisconnectDF() { myDf = null; }