Skip to content

Latest commit

 

History

History
78 lines (67 loc) · 5.36 KB

README.md

File metadata and controls

78 lines (67 loc) · 5.36 KB

VirtualKeyboardControl

VirtualKeyboardControl is a full-featured On-Screen Keyboard with customizable layouts,languages and themes. The layout and languages can be added using xml files. The theme for buttons provided is a verbatim copy from MahApps.Metro.

This library also contains VkbTextBox control which is a Textbox control with the keyboard attached.

Usage

Include Wpfkeyboard.dll Wpfkeyboard.Resources.dll

In App.xaml

<Application x:Class="WpfApplication2.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/WpfKeyboard.Resources;component/styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/WpfKeyboard.Resources;component/styles/Button.xaml" />
                <ResourceDictionary Source="pack://application:,,,/WpfKeyboard.Resources;component/styles/ToggleButton.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

In your MainWindow

add xml reference xmlns:wpfKeyBoard="clr-namespace:wpfKeyBoard;assembly=wpfKeyBoard"

then <wpfKeyBoard:VirtualKeyboardControl x:Name="KeyboardControl" VirtualKeyPressed="KeyboardControl_OnVirtualKeyPressed" /> or <wpfKeyBoard:VkbTextBox Width="400" VerticalContentAlignment="Center" EnterClosesKeyboard="True" />

Existing Keyboard Layouts

Apart from the styles Wpfkeyboard.Resources.dll contains two keyboard layouts en-US,ar-SA, FontAwesome for rendering icons,

Creating your own Keyboard Layouts

Here is the short version of the existing keyboard file. The attributes used are explained in the below table.For Multi-page switcheroos just use the switcheroo name and the page index (eg. <numSym1>{</numSym>)

<keyboard default="true" rows="4" columns="24" langcode="en" langName="English" langNative="English" description="English QWERTY Layout">
  <switcheroos>
    <normal default="true" fontFamily="Segoe UI">
    <shift volatile="true" fontFamily="Segoe UI">
<!--by specifying the fontfamilyUri, specified font is used when displaying this key collection -->
    <smiley fontfamilyUri="/WpfKeyboard.Resources;Component/fonts/#Emoticons" >
    <numSym pages="2"/>
    <ctrl volatile="true" />
  </switcheroos>
	<row>
		<key>
			<normal>q</normal>
			<shift>Q</shift>
			<numSym keytype="virtual" keycode="Tab"></numSym>
			<smiley>;)</smiley>
      <ctrl>q</ctrl>
		</key>
		....
		<key>
			<normal>t</normal>
			<shift>T</shift>
			<numSym>$</numSym>
			<smiley>;)</smiley>
      <ctrl>new tab</ctrl>
		</key>
		....
	</row>
	....
</keyboard>
attributeusageavailable in tag
rowsnumber of rows in keyboardkeyboard
columnsnumber of columns in keyboardkeyboard
defaultthe default lang/layout to showkeyboard
langcodetypically ISO2 language codekeyboard
langNameName of the languagekeyboard
langNativeNative Name of languagekeyboard
descriptionkeyboard layout descriptionkeyboard
defaultthis is the layout that will appearswitcheroos<switcheroo-name>
fontfamilyUria wpf pack uri for this swictherooswitcheroos<switcheroo-name>
fontFamilyfont family name for this swictherooswitcheroos<switcheroo-name>
volatilekey state is volatile, like shiftswitcheroos<switcheroo-name>
pagesnumber of pagesswitcheroos<switcheroo-name>
keytypewpfKeyBoard.Model.KeyTyperow/key/<switcheroo-name>
keycodeSystem.Input.Key valuerow/key/<switcheroo-name>
colspanxrow/key/<switcheroo-name>
rotaterotates the text by given degressrow/key/<switcheroo-name>
switcherooCodexrow/key/<switcheroo-name>
columnxrow/key/<switcheroo-name>
pageActionaction string to execute when nay page button is pressedrow/key/<switcheroo-name>
enabledxrow/key/<switcheroo-name>
valueuse this value instead from the 'tag value'row/key/<switcheroo-name>
usesRendereruses FontAwesome font to draw iconrow/key/<switcheroo-name>