TouchKeyboard.Avalonia 0.3.0

dotnet add package TouchKeyboard.Avalonia --version 0.3.0
                    
NuGet\Install-Package TouchKeyboard.Avalonia -Version 0.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TouchKeyboard.Avalonia" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TouchKeyboard.Avalonia" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="TouchKeyboard.Avalonia" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TouchKeyboard.Avalonia --version 0.3.0
                    
#r "nuget: TouchKeyboard.Avalonia, 0.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TouchKeyboard.Avalonia@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TouchKeyboard.Avalonia&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=TouchKeyboard.Avalonia&version=0.3.0
                    
Install as a Cake Tool

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.
  • IEditorAdapter adapters for TextBox, NumericUpDown and CalendarDatePicker; custom adapters can be registered.
  • Automatic light/dark theme following, TouchKeyboardTheme overrides and a compact TouchKeyboardOptions.Style facade for scale, semantics and fonts.
  • Platform-aware default font stacks (TouchKeyboardFonts) and Style.FontFamily for a host font override.
  • KeyboardLanguage for Chinese or English key legends and chrome without changing geometry.
  • Touch keys with pointer capture, press feedback and long-press repeat.
  • zh-CN and en-US localizers; ITouchKeyboardLocalizer for other cultures.
  • Physical keyboard handling and focus restore.
  • Long-press title-row panel dragging (EnablePanelDrag, default true).

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 100 11/9/2026
0.2.1 93 11/9/2026
0.2.0 102 11/8/2026