Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a set of radio buttons, I want the user to be able to go press them with the F keys, i.e group one is F1, F2, F3, F4.

Is there an easier way than creating a command for to press each one and then using an InputBinding?

i.e. can I write some XAML that says - 'on F1 press radio button 1'?

Thanks in advance!!
Posted

1 solution

I am not sure i understand your question but i will try to answer it anyway.
Why not add a keydown/keyup event on your Xaml window?
and then C# Code behind it.

C#
private void Window_KeyUp(object sender, KeyEventArgs e)
     {
switch(e.Key)
{
    case Key.F1:
        radioButton1.IsChecked = true;
        break;
    case Key.F2:
        radioButton2.IsChecked = true;
        break;
    case Key.F3:
        radioButton3.IsChecked = true;
        break;
    case Key.F4:
           radioButton4.IsChecked = true;
        break;
}


     }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900