ListView selected item color before navigation

Hello,
I would like for a brief instant the background color of the selected item to change before navigating back. I have read this :

https://www.syncfusion.com/kb/11684/how-to-apply-listview-selected-item-color-in-xamarin-forms-navigation-sflistview

Is there anyway to achieve this effect without the need of Task.Delay ?

My code currently:

        private async Task ItemSelected(Syncfusion.ListView.XForms.ItemSelectionChangedEventArgs obj)
        {
                var itemSelected = obj.AddedItems.FirstOrDefault() as IbItem;
                itemSelected.BackgroundColor = (Color)Application.Current.Resources["primaryDarkColor"];

                await CoreMethods.PopPageModel(itemSelected, true,true);
                return;
        }

1 Reply 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team March 9, 2021 01:21 PM UTC

Hi Laurence,

Thank you for the contacting syncfusion support.

#Regarding
ListView selected item color before navigation 
We would like to inform you that as per implementation of SfListview, the selection changed command will raised as soon as selection made in the view. So, we need some sort of delay in the process to execute the selected item color changed before navigation. It is an expected behavior.

please let us know if you have any concern.

Regards,
SaiGanesh Sakthivel
 


Marked as answer
Loader.
Up arrow icon