<syncfusion:SfRadioGroup x:Name="radioGroup">
<syncfusion:SfRadioButton x:Name="check" Text="Checked State" IsChecked="True" StateChanged="RadioButton_StateChanged"/>
<syncfusion:SfRadioButton x:Name="uncheck" Text="Unchecked State" StateChanged="RadioButton_StateChanged"/>
</syncfusion:SfRadioGroup>
private void RadioButton_StateChanged(object sender, StateChangedEventArgs e)
{
if (e.IsChecked.HasValue && e.IsChecked.Value)
{
(sender as SfRadioButton).Text = "Checked State";
}
else if (e.IsChecked.HasValue && !e.IsChecked.Value)
{
(sender as SfRadioButton).Text = "Unchecked State";
}
}
that means doing this below has no difference if i change manuall ischecked of one when other is unchecked. There should be some event over syncfusion:SfRadioGroup level to determine which RadioButton is selected just like a picker because you can only select 1 item. Like that it is not very useful.<syncfusion:SfRadioButton x:Name="check" Text="Checked State" IsChecked="True" StateChanged="RadioButton_StateChanged"/>
<syncfusion:SfRadioButton x:Name="uncheck" Text="Unchecked State" StateChanged="RadioButton_StateChanged"/>
|
I don’t understand the purpose of SfRadioGroup, if each syncfusion:SfRadioButton works independently. Basically, according to the sample below 2 radio button are not dependent because when i change 1 buttons state, it fires statechanged 2 times for each button. |
SfRadioGroup allows us to select one option from a list of predefined choices. When you select the radio button in the same group then it will automatically deselect the previous selected radio button.
For example, if you have the choice for gender as Male or Female with Male is selected as default and when you select the Female then it will automatically deselect the Male.
In the given Xaml, both the “check” and “uncheck” radio buttons are registered to “RadioButton_StateChanged” event and “check” radio button is selected by default. The StateChanged event will fire when the value of IsChecked property is changed.
When you select the “uncheck” radio button then it will change the IsChecked property of “check” radio button to false and “uncheck” radio button’s IsChecked property as true so it will fire the StateChanged event two times. |
|
that means doing this below has no difference if i change manuall ischecked of one when other is unchecked. There should be some event over syncfusion:SfRadioGroup level to determine which RadioButton is selected just like a picker because you can only select 1 item. Like that it is not very useful.
|
We have considered your request as a feature "CheckChanged event for SfRadioGroup” to handle the selection changed in radio buttons. We have logged this as a feature and it will be available in any of our upcoming release |