CollectionView not firing SelectionChangedCommand

JohnLivermoreJohnLivermore USMember ✭✭
edited June 26 in Xamarin.Forms

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...

    <CollectionView SelectionMode="Single"
                    ItemsSource="{Binding Tags}"
                    SelectedItem="{Binding SelectedTag, Mode=TwoWay}"
                    SelectionChangedCommand="{Binding SelectedTagChangedCommand}">
                    <Label Text="{Binding .}" />

And the page model...

public class MainPageModel : FreshBasePageModel
    public override void Init(object initData)
        Tags = new ObservableCollection<string>() { "A", "B", "C" };
        SelectedTag = "B";


    public ObservableCollection<string> Tags { get; set; }

    public string SelectedTag { get; set; }

    public Command SelectedTagChangedCommand
            return new Command(() =>
                   // ****** 
                   // ****** this is never called
                   // ****** 

Can anyone see the issue here?


  • hwj700hwj700 Member ✭✭

    You can find the status of the development of CollectionView in
    It states -and that is also my experience- that selection for UWP is still in progress. For Android it works.

  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭
    edited July 1

    Does SelectedTag changes?

  • JohnLivermoreJohnLivermore USMember ✭✭

    @Amar_Bait yes, the SelectedTag did change, but I was using UWP, and the issues I am experiencing are localized to that platform. And, I have come to find out, CollectionView is not supported yet. It "sort of" works in that it displays the list, etc, but most of the commanding and properties are non-functional. So we are just dropping back to the old ListView for now...

  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭

    Yeah UWP is clearly dying and Microsoft is abandoning it, they will probably merge it with a new WPF version in the future (.NET 5)

  • SunnyMSunnyM USMember
    edited July 24

    Everything works fine on iOS and Android. I would avoid developing for UWP since it's dead anyway.

Sign In or Register to comment.