/// <summary> /// Occurs when the Control gets focus. /// </summary> /// /// <param name="e">The <see cref="T:System.Windows.RoutedEventArgs" /> that contains the event data.</param> /// /// <seealso cref="M:System.Windows.FrameworkElement.OnGotFocus(RoutedEventArgs)"/> protected override void OnGotFocus(RoutedEventArgs e) { try { if (_renderWindow != null) { IntPtr hWnd = _renderWindow.GetGenericWindowId(); if (IntPtr.Zero != hWnd) { Win32.SetFocus(hWnd); } } } catch (Exception ex) { log.ErrorException("OnGotFocus()", ex); } base.OnGotFocus(e); }