Browse Source

Don't re-focus already focused control.

This actually fixes the TextBox selection problem.
pull/58/head
Steven Kirk 11 years ago
parent
commit
d6b771bcea
  1. 33
      Perspex.Input/KeyboardDevice.cs

33
Perspex.Input/KeyboardDevice.cs

@ -48,26 +48,29 @@ namespace Perspex.Input
public void SetFocusedElement(IInputElement element, bool keyboardNavigated)
{
var interactive = this.FocusedElement as IInteractive;
if (interactive != null)
if (element != this.FocusedElement)
{
interactive.RaiseEvent(new RoutedEventArgs
var interactive = this.FocusedElement as IInteractive;
if (interactive != null)
{
RoutedEvent = InputElement.LostFocusEvent,
});
}
interactive.RaiseEvent(new RoutedEventArgs
{
RoutedEvent = InputElement.LostFocusEvent,
});
}
this.FocusedElement = element;
interactive = element as IInteractive;
this.FocusedElement = element;
interactive = element as IInteractive;
if (interactive != null)
{
interactive.RaiseEvent(new GotFocusEventArgs
if (interactive != null)
{
RoutedEvent = InputElement.GotFocusEvent,
KeyboardNavigated = keyboardNavigated,
});
interactive.RaiseEvent(new GotFocusEventArgs
{
RoutedEvent = InputElement.GotFocusEvent,
KeyboardNavigated = keyboardNavigated,
});
}
}
}

Loading…
Cancel
Save