Pick up selected Radiobuttons in WPF

Asked

Viewed 201 times

4

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

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;
} 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.