private void Window_Loaded(object sender, RoutedEventArgs e) { viewModel.ParentWindow = this; DataObject.AddPastingHandler(tbSearchFor, new DataObjectPastingEventHandler(OnPaste)); DataObject.AddPastingHandler(tbReplaceWith, new DataObjectPastingEventHandler(OnPaste)); if (tbSearchFor.Template.FindName("PART_EditableTextBox", tbSearchFor) is TextBox textBox && !tbSearchFor.IsDropDownOpen) { Dispatcher.BeginInvoke(new Action(() => { textBox.SelectAll(); textBox.Focus(); })); } DockSite.InitFloatingWindows(); }