Get Selected RadioButtons in WPF

4

I have several radiobuttons on my form, each with a content different. How do I get the radiobuttom selected? Without having to método to check one by one.

    
asked by anonymous 16.08.2015 / 17:01

1 answer

3

You can use the event Checked :

<RadioButton Name="radioButton1" Checked="radioButton_Checked">Opcao 1</RadioButton>
<RadioButton Name="radioButton2" Checked="radioButton_Checked">Opcao 2</RadioButton>

Function:

private void radioButton_Checked(object sender, RoutedEventArgs e)
{
    opcaoEscolhida = (RadioButton)sender;
} 
    
16.08.2015 / 17:19