KeyBoard.WPF 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package KeyBoard.WPF --version 2.0.0                
NuGet\Install-Package KeyBoard.WPF -Version 2.0.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="KeyBoard.WPF" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KeyBoard.WPF --version 2.0.0                
#r "nuget: KeyBoard.WPF, 2.0.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.
// Install KeyBoard.WPF as a Cake Addin
#addin nuget:?package=KeyBoard.WPF&version=2.0.0

// Install KeyBoard.WPF as a Cake Tool
#tool nuget:?package=KeyBoard.WPF&version=2.0.0                

KeyBoard.WPF

一款用于触摸屏输入的屏幕软键盘

开发信息

  • NET6 + VS2022
  • 使用WPF

支持功能

  • 支持NET6及以上版本
  • 支持Net Framework4.62
  • 目前提供2个键盘可选,数字小键盘和全键盘,全键盘是可以打中文的,前提是你的电脑有安装中文包
  • 使用的是WPF的行为,目前只能在WPF项目中使用
  • 目前键盘只支持单键的按下、松开模拟,跟使用实体键盘一样,但是不支持组合键,且有些键盘上的特殊键(如PageUp等也不支持)
  • 使用钩子函数模拟键盘的按下和松开,代码简单,可以自己下载源码编译为其他版本

快速使用

在XAML中先引入包的命名空间

xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:keyboard="clr-namespace:KeyBoard.WPF.Behavior;assembly=KeyBoard.WPF"

小键盘(NumericKeyboardBehavior)

<i:Interaction.Behaviors>
    <keyboard:NumericKeyboardBehavior/>
</i:Interaction.Behaviors>

数字键盘

全键盘(KeyboardBehavior)

<i:Interaction.Behaviors>
    <keyboard:KeyboardBehavior/>
</i:Interaction.Behaviors>

全键盘

可选配置

设置键盘的底色

<i:Interaction.Behaviors>
    <keyboard:KeyboardBehavior UCBackground="Red"/>
</i:Interaction.Behaviors>

注意事项

  • 为了适应(TextBox、PasswordBox等)输入框,在创建行为时,继承的是Behavior<Control>,理论上是可以在任何继承自Control类的控件中使用,但除了输入框,放在其他的控件上是没有意义的
  • 目前的版本,使用了键盘行为的控件必须位于一个继承自Panel的容器中
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
2.0.2 353 3/19/2024
2.0.1 103 3/18/2024
2.0.0 122 3/18/2024
1.0.5 606 3/13/2023
1.0.4 289 2/24/2023
1.0.3 457 2/21/2023
1.0.2 644 7/20/2022
1.0.1 454 7/18/2022
1.0.0 505 7/18/2022

添加Net462的支持