private void TextBox_KeyDown_1(object sender, System.Windows.Input.KeyEventArgs e) { try { if (e.Key == Key.Enter) { var list = VkApi.FindAudio(FindText.Text); if (list == null) { return; } for (var i = 0; i < PlayListTabs.Items.Count; i++) { if ((string)((TabItem)PlayListTabs.Items[i]).Header == "Найденые...") { PlayListTabs.Items.Remove(PlayListTabs.Items[i]); break; } } NewPlaylist("Найденые...", list); var t = (ScrollViewer)PlayListTabs.Template.FindName("ScrollViewerTab", PlayListTabs); t.ScrollToHorizontalOffset(PlayListTabs.SelectedIndex * 110); } } catch (NetworkInformationException) { System.Windows.Forms.MessageBox.Show(@"Ошибка интернет соединения."); } }