private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Escape) { if (this.currentTabIndex > 0 && this.currentTabIndex < tab.Count) { tab[this.currentTabIndex].TextEditor.Select(0, 0); this.currentSearchIndex = 0; } } }