'How to get the selected value of RadioButton in Xamarin
So for the previous post I managed to populate my xaml with my desired dynamic control. I have this model holding the property of the control
public Guid Id { get; set; }
public string ControlType { get; set; }
public string Description { get; set; }
public string Name { get; set; }
public string GroupName { get; set; }
public int? MinNumberValue { get; set; }
public int? MaxNumberValue { get; set; }
public string SelectedValue { get; set; }
And in my xaml I have predefined controls then populate some properties base on the model.
<Stacklayout Bindable.ItemSource="{Binding ListofControls}">
<BindableLayout.ItemTemplate>
<DataTemplate x:DataType="survey:ControlModel">
<Stacklayout>
<RadioButton CheckChanged="{Binding CheckValueChanged}".... />
</Stacklayout>
</DataTemplate>
</Bindablelayout.ItemTemplate>
</Stacklayout>
So the code above is on a nested stacklayout. However, I want to bind my checkchanged method in the RadioButton to get the selected value, but it can't be found. The error says, Method "CheckValueChanged" not found in ControlModel.
Public void CheckValueChanged(object sender, EventArgs args)
{
RadioButton radio = sender as RadioButton;
var i = radio.Content;
}
Can anyone help me about this, cause I'm going do to all other events for the other control type.
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
