How to inject a VirtualKeyboard
See original GitHub issueI have made simple VirtualKeyboard.
In my case I would like to as soon as the TextBox receives the InputFocus, transfer the Text of the TextBox to the VirtualKeyboard and open it in a separate Window (RaspberryPie currently only supports a single window). This is finally closed with Return and transferred to the TextBox.
I would like to avoid having to create my own CustomTextbox that the VirtualKeyboard opens automatically.

Now I would like to combine it with avaloniaui. As you already mentioned here https://github.com/AvaloniaUI/Avalonia/issues/3415 it should be possible. But actually I’m a little bit stuck and don’t know how to go on.
The events TextInputOptionsQuery and TextInputMethodClientRequested are not called.
var boxes = this.GetLogicalDescendants().OfType<TextBox>().ToList();
foreach (var box in boxes)
{
box.TextInputOptionsQuery += (o, eventArgs) =>
{
// is not called
};
box.TextInputMethodClientRequested += (o, eventArgs) =>
{
// is not called
};
}
As soon as the VirtualKeyboard works, I will share my code so that it may even be included in the repo or to improve it.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (2 by maintainers)

Top Related StackOverflow Question
For those who also want to implement a virtual keyboard, here is the source code.
Improvements are always welcome
Layout/KeyboardLayout.cs
Layout/VirtualKeyboardLayoutDE.axaml
Layout/VirtualKeyboardLayoutUS.axaml
VirtualKey.axaml
VirtualKeyboard.axaml
VirtualKeyboardTextInputMethod.cs
VirtualKeyWidthMultiplayer.cs
CoporateWindow
The
CoporateWindowis just a normalWindowwith a default styling. It can easily be replaced by the normalWindow.Usage
define available layouts and set func which one should be used when opening (based on the language of the current logged in user for example).
Add the
VirtualKeyboardTextInputMethodto yourMainWindow. Here you can optional check your local settings (of your app) if you need theVirtualKeyboardor not.Hello @nullx1337 thanks so much, i was searching for this for long, could you please share a working code that can compile with avalonia 11 ? thanks