I'm using Xamarin.Forms 5 and I need to bind a Command to IsChecked radioButton property. How can I do this? I tryed to add a behavior on IsFocused event, since IsChecked event doesn't exist, like so, but nothing happens:
<RadioButton.Behaviors>
<behaviors:EventToCommandBehavior EventName="IsFocused" Command="{Binding ChangeStateCommand}" CommandParameter="V"/>
</RadioButton.Behaviors>
CodePudding user response:
If you want to run a command upon state change then you can use the event CheckedChanged
<RadioButton>
<RadioButton.Behaviors>
<behaviors:EventToCommandBehavior EventName="CheckedChanged" Command="{Binding ChangeStateCommand}" CommandParameter="V"/>
</RadioButton.Behaviors>
</RadioButton>
