I am currently in the process of creating a Onscreen keyboard. I am handling the button click using routedcommands. The issue is that when i click on the button in keyboard
I had to use this to get my desired result
FocusManager.SetFocusedElement(this, UserNameautoCompleteBox);
Key key = Key.Enter; // Key to send
var target = Keyboard.FocusedElement; // Target element
RoutedEvent routedEvent = Keyboard.KeyDownEvent; // Event to send
target.RaiseEvent(
new KeyEventArgs(
Keyboard.PrimaryDevice,
PresentationSource.FromVisual(UserNameautoCompleteBox),
0,
key) { RoutedEvent = routedEvent }
);