If I have multiple TextBoxes and other text insertion controls and I want to create some buttons that insert special characters into whichever TextBox is in focus, what is the best control for this and what properties should be set?
Requirements for the buttons:
- Buttons do not steal focus when clicked.
- Buttons can insert text (e.g. special characters) into any control that accepts keyboard input.
- The cursor should move as if the user had entered the text on the keyboard.
If #2 is not possible, it will suffice to limit the controls to only TextBoxes.
NOTE: I do not want to make the buttons unfocusable, only such that they do not steal focus when clicked.
I’m not aware of any button that is not stealing focus when it is clicked, but in button click event handle you can return focus to previous owner. If I had to implement this I’d create an behavior that is attached to parent panel of all special textboxes and all buttons that are to insert some text.
For sample simplicity I’ve put text that is to be inserted to textbox in Tag property.
}
This does more or less what you described but it is far from perfect I think it is enough to get you started.