MindFusion.Wpf Pack Programmer's Guide
Keyboard Layout

The component includes two predefined keyboard layouts represented by Default and Extended members of the KeyboardMode enumeration, that can be assigned to the Mode property of VirtualKeyboard. The Default layout is similar to a laptop keyboard without a numpad. Extended mode corresponds to a full keyboard with numpad and navigational key sections.

You can also create custom layouts represented by KeyboardLayout objects by populating their Keys collections. A KeyboardLayout can be assigned to the TemplateLayout property of VirtualKeyboard to create a language-independent layout whose character labels are automatically set from current locale information. Alternatively, you could set Mode to Custom and specify the location of language-dependent layout files via LayoutsFolder.

While it is possible to create a KeyboardLayout programmatically, it is far easier to use the Keyboard Creator tool installed with the control. You can quickly generate initial layout by choosing a language from the property palette and selecting the Default Layout or Extended Layout commands from Layout menu. You can then remove unnecessary keys, move or resize existing ones or change their labels. You could as well build a layout from scratch by dragging and dropping keys from the various palettes below the menu.

Once you are happy with the result, save the layout to a file. The file can be loaded into the application by either placing it in LayoutsFolder (in which case you should also keep the locale ID part added to the name by the tool), or by calling the static Create method of KeyboardLayout and assigning the result to TemplateLayout:

C#  Copy Code

virtualKeyboard.TemplateLayout = KeyboardLayout.Create("mylayout.xml");