/// <summary> /// Sets the element that will receive key events /// </summary> /// <param name="element">element.</param> public void SetKeyboardFocus(IKeyboardListener element) { // clean up if we are removing focus if (element == null) { _lastPressedKeys = _emptyKeys; ClearKeyRepeatTimer(); } if (_keyboardFocusElement == element) { return; } var oldKeyboardFocus = _keyboardFocusElement; if (oldKeyboardFocus != null) { oldKeyboardFocus.LostFocus(); } _keyboardFocusElement = element; if (_keyboardFocusElement != null) { _keyboardFocusElement.GainedFocus(); } }