Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Collection View Highlight the last added item

Hi I am using collection view with signalR , data will add for my collection view , i want to show different color for last added item to the list. Thanks


  • stXamDevstXamDev Member ✭✭✭

    make a boolean field IsLastItem in your model then when you add the last item or you can check via traversing set that field to true. Make a data trigger for that field and set a different color for the last field

  • JarvanJarvan Member, Xamarin Team Xamurai

    Collection View Highlight the last added item

    In the CollectionView, the selected item will highlight. For the function, you could set the last item as the selected item.

    Check the code:

    <CollectionView x:Name="collectionView"
                    ItemsSource="{Binding GroupDataCollection}" 
                    SelectionMode="Single" ...>


    var viewModel = new CustomViewModel();
    viewModel.DataCollection.Add(new CustomModel { ... });
    collectionView.SelectedItem = viewModel.DataCollection[viewModel.DataCollection.Count - 1];
Sign In or Register to comment.