Giter Club home page Giter Club logo

wpf-keyboard's Introduction

WpfKeyboard

I have been trying to find a good on screen keyboard that I could use in a locked down kiosk based environment.  Many of the keyboards I did find were built to run out of process and also had their own keyboard designers built in.  Although this worked I always found myself working aroudn limitations this created.
  *  The keyboard ran out of process requiring IPC to hide/show the keyboard.  This was prone to breaking
  *  The keyboard came with it's own designer, but was limited in it's styling capabilities
  *  Internationalization support was generisized and didn't meat my requirements
  *  Keyboards were typically ties to virtual keys, causing default shifting behavior.  This made it difficult to design a keyboard              exactly as required
  *  Styling the keyboard to match desired design of staff designers was difficult.


The goals I am after with this keyboard are:
  *  Custom control that can be hosting directly in a custom WPF application
  *  Ability to use Visual Studio or Blend designer to easily make new keyboard layouts (with minimal developer intervention required)
  *  A small wrapper that can also allow for hosting the keyboard out of process (This is very secondary)


Example Usage (As of right now)
The API is changing a lot as this development effort is currently starting.  Example usage is below.  The below example would ideally seperate out the keyboard content in a seperate file, but the idea is below.  The below keyboard keys would take on default styling (which is a bit ugly at the moment).  This example would provide a numeric keypad keyboard that would allow for touch based input of 0-9.  This would easily extend to provide other keyboard keys.

<Grid>
    <kbrd:Keyboard Grid.Row="2" x:Name="_keyboard" Content="{Binding {StaticResource Numeric}}"></kbrd:Keyboard>
</Grid>

 <Grid x:Key="Numeric">
   <Grid.RowDefinitions>
       <RowDefinition Height="*" />
       <RowDefinition Height="*" />
       <RowDefinition Height="*" />
       <RowDefinition Height="*" />
   </Grid.RowDefinitions>
   <Grid.ColumnDefinitions>
       <ColumnDefinition Width="*" />
       <ColumnDefinition Width="*" />
       <ColumnDefinition Width="*" />
   </Grid.ColumnDefinitions>

   <kbrd:UnicodeKeyboardKey UnshiftedContent="7" UnshiftedText="7" Grid.Row="0" Grid.Column="0"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="8" UnshiftedText="8" Grid.Row="0" Grid.Column="1"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="9" UnshiftedText="9" Grid.Row="0" Grid.Column="2"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="4" UnshiftedText="7" Grid.Row="1" Grid.Column="0"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="5" UnshiftedText="8" Grid.Row="1" Grid.Column="1"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="6" UnshiftedText="9" Grid.Row="1" Grid.Column="2"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="1" UnshiftedText="7" Grid.Row="2" Grid.Column="0"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="2" UnshiftedText="8" Grid.Row="2" Grid.Column="1"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="3" UnshiftedText="9" Grid.Row="2" Grid.Column="2"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="0" UnshiftedText="7" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"/>
   <kbrd:UnicodeKeyboardKey UnshiftedContent="." UnshiftedText="." Grid.Row="3" Grid.Column="2"/>
 </Grid>

There is also a ShiftKeyboardKey that can be added to a keyboard that will "shift" context switch all keyboard keys when it is toggled on and off.  Every keyboard key has both Shifted and Unshifted content that can be set.  This content will automatically show and hide depending on the context of the shift key.  Below is a couple xaml lines showing what those keys look like

<StackPanel x:Key="OneCharacterKeyboardWithShift" Orientation="Horizontal">
    <kbrd:UnicodeKeyboardKey UnshiftedContent="1" ShiftedContent="!" UnshiftedText="1" ShiftedUnicodeText="!" />
    <kbrd:ShiftKeyboardKey UnshiftedContent="SHIFT" ShiftedContent="SHIFTED" />
</StackPanel>

There are currently three types of keys that can be used.
ShiftKeyboardKey - provides shift context switching of the entire keyboard
UnicodeKeyboardKey - provides the ability to emulate unicode input (in addition, strings of text can be input like ".com")
VirtualKeyKeyboardKey - provides virtual key input.  When shift context is in effect, the virtual key will behave like shift context for the current local on the windows machine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.