Overriding the default keys used to navigate in RadioButtons [WPF] [VB]
-
Hi, In my application, the user has to navigate through RadioButton's group using the keyboard By default, the arrow keys are used to navigate and the space bar used to select the radio button. I would like the 'select' key to be another keyboard key! How should I please process to switch the key used for the button selection by the "A" key, for instance? Thank you for any kind help!
-
Hi, In my application, the user has to navigate through RadioButton's group using the keyboard By default, the arrow keys are used to navigate and the space bar used to select the radio button. I would like the 'select' key to be another keyboard key! How should I please process to switch the key used for the button selection by the "A" key, for instance? Thank you for any kind help!
You mean add a underscore (_) to the content? If you do "Radio Button #_1", the 1 will be underlined and a user can hit Alt+1 to select the radio button.
-
Hi, In my application, the user has to navigate through RadioButton's group using the keyboard By default, the arrow keys are used to navigate and the space bar used to select the radio button. I would like the 'select' key to be another keyboard key! How should I please process to switch the key used for the button selection by the "A" key, for instance? Thank you for any kind help!
A quick and dirty way would be to use your own RadioButton-derived class that responds to the key press you want, something like:
public class MyRadioButton : RadioButton { protected override void OnKeyDown(KeyEventArgs e) { if (e.Key == Key.A) OnClick(); else base.OnKeyDown(e); } }
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
You mean add a underscore (_) to the content? If you do "Radio Button #_1", the 1 will be underlined and a user can hit Alt+1 to select the radio button.