TouchKeyboard.Avalonia
0.3.0
dotnet add package TouchKeyboard.Avalonia --version 0.3.0
NuGet\Install-Package TouchKeyboard.Avalonia -Version 0.3.0
<PackageReference Include="TouchKeyboard.Avalonia" Version="0.3.0" />
<PackageVersion Include="TouchKeyboard.Avalonia" Version="0.3.0" />
<PackageReference Include="TouchKeyboard.Avalonia" />
paket add TouchKeyboard.Avalonia --version 0.3.0
#r "nuget: TouchKeyboard.Avalonia, 0.3.0"
#:package TouchKeyboard.Avalonia@0.3.0
#addin nuget:?package=TouchKeyboard.Avalonia&version=0.3.0
#tool nuget:?package=TouchKeyboard.Avalonia&version=0.3.0
TouchKeyboard.Avalonia
English · 简体中文
Touch-first overlay keyboard for Avalonia 12.0.5+, built
for small industrial touch screens. This package is the Avalonia frontend for
TouchKeyboard; the input model
lives in TouchKeyboard.Core.
The keyboard opens in the host window, covers the page with a scrim, edits a single-line buffer and commits the validated text through an adapter. It does not depend on the platform on-screen keyboard.
Install
dotnet add package TouchKeyboard.Avalonia
Quick start
Place the host last in the window's root grid and mark the fields with attached properties:
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tk="using:TouchKeyboard.Avalonia">
<Grid>
<StackPanel Margin="16" Spacing="12">
<TextBox tk:TouchKeyboardInput.Profile="text"
tk:TouchKeyboardInput.Label="Name" />
<NumericUpDown tk:TouchKeyboardInput.Profile="positive-decimal"
tk:TouchKeyboardInput.Label="Temperature"
tk:TouchKeyboardInput.Unit="℃"
Minimum="0" Maximum="100" Value="25" />
<TextBox tk:TouchKeyboardInput.Profile="password"
tk:TouchKeyboardInput.Label="Password"
PasswordChar="*" />
</StackPanel>
<tk:TouchKeyboardHost x:Name="KeyboardHost" />
</Grid>
</Window>
using Avalonia.Controls;
using TouchKeyboard.Avalonia;
using TouchKeyboard.Core;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
KeyboardHost.Configure(options =>
{
options.FullKeyboardLayout = FullKeyboardLayoutKind.AnsiStyle;
options.KeyHeight = 64;
options.MaxPanelWidth = 1100;
options.Culture = "zh-CN";
});
}
}
KeyboardHost is the code-behind field generated by the x:Name; the control
type is TouchKeyboardHost. AutoAttach is on by default.
Built-in integration
- Overlay host with scrim, label/unit/error row, custom-drawn editor and a stable keyboard area.
IEditorAdapteradapters forTextBox,NumericUpDownandCalendarDatePicker; custom adapters can be registered.- Automatic light/dark theme following,
TouchKeyboardThemeoverrides and a compactTouchKeyboardOptions.Stylefacade for scale, semantics and fonts. - Platform-aware default font stacks (
TouchKeyboardFonts) andStyle.FontFamilyfor a host font override. KeyboardLanguagefor Chinese or English key legends and chrome without changing geometry.- Touch keys with pointer capture, press feedback and long-press repeat.
zh-CNanden-USlocalizers;ITouchKeyboardLocalizerfor other cultures.- Physical keyboard handling and focus restore.
- Long-press title-row panel dragging (
EnablePanelDrag, defaulttrue).
Language and fonts
KeyboardHost.Configure(options =>
{
options.KeyLanguage = KeyboardLanguage.English; // Confirm, Clear, Symbols, CN/EN
options.Style.FontFamily = new FontFamily("Noto Sans CJK SC");
});
Auto (default) follows Culture, then the current UI culture. The platform
font chains are Segoe UI, Microsoft YaHei UI, Microsoft YaHei on Windows,
Helvetica Neue, PingFang SC, Hiragino Sans GB on macOS and Noto Sans, Noto Sans CJK SC, WenQuanYi Micro Hei, DejaVu Sans on Linux. Font files are
not bundled; a CJK face must be installed for Chinese text.
Optional Chinese input
dotnet add package TouchKeyboard.Ime.Pinyin
using TouchKeyboard.Ime.Pinyin;
KeyboardHost.Configure(options => options.UseIme(new PinyinImeEngine()));
text fields get an IME key (中/英 in Chinese, CN/EN in English), a fixed candidate row and inline composition.
Numeric, date, password and ASCII profiles stay IME-free. Without an engine
there is no IME key or candidate row, and Space keeps the expanded no-IME width.
Documentation
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Avalonia (>= 12.0.5)
- TouchKeyboard.Core (>= 0.3.0)
-
net8.0
- Avalonia (>= 12.0.5)
- TouchKeyboard.Core (>= 0.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.