Innova
Innova

Reputation: 396

Bind command on IsChecked RadioButton property

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>

Upvotes: 0

Views: 225

Answers (1)

Cfun
Cfun

Reputation: 9701

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>

Upvotes: 1

Related Questions