private void GameBoard_GameOver(object sender, int score) { _buttonsUserControl.ButtonPauseResume.IsEnabled = false; if (_highScoreList.IsRecord(score)) { HighScoreInputUserControl1.Score = score; HighScoreInputUserControl1.TextBoxInitials.Text = string.Empty; RectangleOverlay.Visibility = Visibility.Visible; HighScoreInputUserControl1.Visibility = Visibility.Visible; // See: http://stackoverflow.com/questions/13955340/keyboard-focus-does-not-work-on-text-box-in-wpf Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() => { HighScoreInputUserControl1.TextBoxInitials.Focus(); Keyboard.Focus(HighScoreInputUserControl1.TextBoxInitials); })); } else { RectangleOverlay.Visibility = Visibility.Visible; GameOverUserControl1.Visibility = Visibility.Visible; } }