We have a simple control that inherits from a RadioButton. I would like to programmically check it.
If it were a button we would click we would normally do.
Button MyButton = ...
MyButtonClickArgs = new RoutedEventArgs(Button.ClickEvent, MyButton);
MyButton.RaiseEvent(MyButtonClickArgs);
So I figured I could do the following with a RadioButton.
RadioButton MyButton = ...
MyButtonClickArgs = new RoutedEventArgs(RadioButton.CheckedEvent, MyButton);
MyButton.RaiseEvent(MyButtonClickArgs);
No such luck however. Anyone know what I'm doing wrong.
Update: Upon further exploration is does appear the OnChecked event handler is being called. However the IsChecked state is false (so it does not do what I expected it to). If IsChecked is false I would expect it to be true by the time the event handler is called. At least that is the behavior if I physically click the button.