I am using FreshMVVM to bind my view models to my views, and all commanding has worked great so far. However, I am not able to get the SelectionChangedCommand to fire when I change the selection of a CollectionView.
Full source code can be found here
Here is my XAML...
<StackLayout>
<CollectionView SelectionMode="Single"
ItemsSource="{Binding Tags}"
SelectedItem="{Binding SelectedTag, Mode=TwoWay}"
SelectionChangedCommand="{Binding SelectedTagChangedCommand}">
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout>
<Label Text="{Binding .}" />
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
And the page model...
public class MainPageModel : FreshBasePageModel
{
public override void Init(object initData)
{
Tags = new ObservableCollection<string>() { "A", "B", "C" };
SelectedTag = "B";
base.Init(initData);
}
public ObservableCollection<string> Tags { get; set; }
public string SelectedTag { get; set; }
public Command SelectedTagChangedCommand
{
get
{
return new Command(() =>
{
// ******
// ****** this is never called
// ******
});
}
}
}
Can anyone see the issue here?