private static void Element_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var sendingElement = (UIElement)sender;

            if (!sendingElement.IsMouseDirectlyOver)
            {
                return;
            }

            var elementToFocus = FocusDeferral.GetDeferFocusOnClick(sendingElement) as UIElement;

            if (elementToFocus != null)
            {
                elementToFocus.Focus();
            }
        }
        private static void Element_KeyDown(object sender, KeyEventArgs e)
        {
            var sendingElement = (UIElement)sender;

            if (Keyboard.Modifiers != ModifierKeys.None)
            {
                return;
            }
            if (e.Key == Key.Up || e.Key == Key.Down || e.Key == Key.Left || e.Key == Key.Right)
            {
                return;
            }

            var elementToFocus = FocusDeferral.GetDeferFocusOnKeydown(sendingElement) as UIElement;

            if (elementToFocus != null)
            {
                elementToFocus.Focus();
            }
        }