Do you have any example or reference on how am I going to add an event to a new RadioButton object. So basically I created an RadioButton object in my ViewModel with properties.
var grid = new Grid();
grid.Children.Add(new RadioButton()
{
IsChecked = question.Answer != null && question.Answer.Value == qa.Value,
IsEnabled = !this.IsReadOnly,
GroupName = $"question-{question.OrderNum}",
}, 0, 0);
So with that I want to add the event of CheckedChaged or SelectedValueChanged so that I can save the selected value of the user from those RadioButton.
Thank you
CodePudding user response:
var grid = new Grid();
var radio = new RadioButton()
{
IsChecked = question.Answer != null && question.Answer.Value == qa.Value,
IsEnabled = !this.IsReadOnly,
GroupName = $"question-{question.OrderNum}",
};
radio.CheckedChanged = myEventHandler;
grid.Children.Add(radio,0,0);