Example #1
0
 private void UpdateButtonLabels()
 {
     foreach (var key in KeyboardButtons)
     {
         if (key.GetKeyType() == VirtualKeyboardButton.KeyType.Input)
         {
             VirtualKeyboardInputButton inputButton = (VirtualKeyboardInputButton)key;
             if (inputButton.GetAutoLabel())
             {
                 string shiftInputValue = inputButton.GetKeyShiftInputValue();
                 inputButton.Content = IsShiftPressed && !String.IsNullOrEmpty(shiftInputValue)
                     ? shiftInputValue
                     : inputButton.GetKeyInputValue();
             }
         }
     }
 }
        public void ProcessCustomKeyboardKeys()
        {
            foreach (var customKeyLayout in this.customKeyboardLayout)
            {
                string row       = customKeyLayout[0];
                int    index     = int.Parse(customKeyLayout[1]);
                string lowercase = customKeyLayout[2];
                string uppercase = customKeyLayout[3];

                StackPanel keyboardRow = ViewHelpers.FindChildByName <StackPanel>(this, row);

                VirtualKeyboard.VirtualKeyboardInputButton keyToChange = keyboardRow.Children[index] as VirtualKeyboard.VirtualKeyboardInputButton;

                VirtualKeyboard.VirtualKeyboardInputButton.SetKeyInputValue(keyToChange, lowercase);

                if (lowercase != "")
                {
                    VirtualKeyboard.VirtualKeyboardInputButton.SetKeyShiftInputValue(keyToChange, uppercase);
                }
                else if (VirtualKeyboard.VirtualKeyboardInputButton.GetKeyShiftInputValue(keyToChange) != null)
                {
                    uppercase = lowercase;
                    VirtualKeyboard.VirtualKeyboardInputButton.SetKeyShiftInputValue(keyToChange, uppercase);
                }

                if (keyToChange.GetAutoLabel())
                {
                    keyToChange.Content = keyToChange.GetKeyInputValue();
                }
                else
                {
                    StackPanel customKeyLabel = ViewHelpers.FindChildByName <StackPanel>(this, "Label" + customKeyLayout[1]);

                    TextBlock upperCaseLabel = customKeyLabel.Children[0] as TextBlock;
                    upperCaseLabel.Text = uppercase;

                    TextBlock lowerCaseLabel = customKeyLabel.Children[1] as TextBlock;
                    lowerCaseLabel.Text = lowercase;
                }
            }
        }