ojsim
ojsim

Reputation: 467

Event on a selected ComboBoxItem

I have a ComboBox control. When a particular item is selected, I would like to disable some RadioButton controls.

Is there any particular event that I could use to do that?

Upvotes: 1

Views: 475

Answers (2)

FIre Panda
FIre Panda

Reputation: 6637

You could do

 private void ComboBox1_SelectedIndexChanged(object sender, 
        System.EventArgs e)
{
     if(((ComboBox)sender).SelectedItem.ToString() == "your value")
              radioBtn1.IsEnabled = false;
}

Upvotes: 0

Alex Aza
Alex Aza

Reputation: 78457

You can use SelectionChanged event.

private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    radioButton1.IsEnabled = comboBox1.SelectedItem == x;

    // or

    radioButton1.IsEnabled = comboBox1.SelectedValue == x;
}

Upvotes: 3

Related Questions