0

RadioButton command property not working after updated from Xamarin.Forms 4.7 to Xamarin.Forms 5.0.0.2337. what are the alternative ways to use command in ViewModel not with codebehind.

Dev
  • 315
  • 2
  • 16
  • this might help. https://pauldboer.medium.com/xamarin-forms-radiobutton-list-source-binding-using-reactiveui-c76ac508 – Amjad S. Feb 11 '22 at 08:59

1 Answers1

3

Yes,since Xamarin.Forms 5.0.0, the property Command has been removed from RadioButton.

If you want to run a command upon state change then you can use the event CheckedChanged.

    <RadioButton Content="test">
        <RadioButton.Behaviors>
            <local:EventToCommandBehavior EventName="CheckedChanged" Command="{Binding Source={x:Reference Page}, Path=BindingContext.RadioCommand}"   CommandParameter="V"/>
        </RadioButton.Behaviors>
    </RadioButton>

For EventToCommandBehavior.cs, you can refer sample code here: https://github.com/xamarin/xamarin-forms-samples/tree/main/Behaviors/EventToCommandBehavior/EventToCommandBehavior/Behaviors .

Note:

Page is the x:Name of current page.

Jessie Zhang -MSFT
  • 9,830
  • 1
  • 7
  • 19