diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/PopupWithKeyboardFocus.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/PopupWithKeyboardFocus.cs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/PopupWithKeyboardFocus.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/PopupWithKeyboardFocus.cs deleted file mode 100644 index 9426b95cf..000000000 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/PopupWithKeyboardFocus.cs +++ /dev/null @@ -1,42 +0,0 @@ -using MaterialDesignThemes.Wpf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls.Primitives; -using System.Windows.Input; -using System.Windows.Interop; - -namespace Tango.SharedUI.Controls -{ - public class PopupWithKeyboardFocus: ComboBoxPopup - { - [DllImport("user32.dll")] - static extern IntPtr SetActiveWindow(IntPtr hWnd); - - static PopupWithKeyboardFocus() - { - EventManager.RegisterClassHandler( - typeof(PopupWithKeyboardFocus), - Popup.PreviewGotKeyboardFocusEvent, - new KeyboardFocusChangedEventHandler(OnPreviewGotKeyboardFocus), - true); - } - - private static void OnPreviewGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e) - { - var textBox = e.NewFocus as TextBoxBase; - if (textBox != null) - { - var hwndSource = PresentationSource.FromVisual(textBox) as HwndSource; - if (hwndSource != null) - { - SetActiveWindow(hwndSource.Handle); - } - } - } - } -} |
