I have been able to get a working solution:
First off I installed Xamarin Forms version 2.3.4.214-pre5, it is working just fine.
Then with the help of the Xamarin Forum, I was given a solution, which is as-follows:
1 - Install the Behaviors.Forms
NuGet package by running Install-Package Behaviors.Forms
in the NuGet package manager console.
2 - Then include the following namespace in the XAML page:
<ContentPage xmlns:behaviors="clr-namespace:Behaviors;assembly=Behaviors">
</ContentPage>
3 - Then add the Picker.Behaviors
attribute in the Picker
tag:
<Picker x:Name="MyPicker"
ItemsSource="{Binding IdentityProviders}"
HorizontalOptions="FillAndExpand" Title="Identity Provider"
Margin="10"
ItemDisplayBinding="{Binding Description}">
<Picker.Behaviors>
<behaviors:EventHandlerBehavior EventName="SelectedIndexChanged">
<behaviors:InvokeCommandAction Command="{Binding SelectedProviderChanged}" />
</behaviors:EventHandlerBehavior>
</Picker.Behaviors>
</Picker>
If you want to pass the data back as a parameter then include the following after the command CommandParameter="{Reference MyPicker}"
That solved my problem, I hope this helps:
The help I got was from this post MVVM Light - How to use the selectedIndexChanged event in viewModel