Articles in this section
Category / Section

How to set AtomationID for ListViewItem in SfListView?

1 min read

The SfListView items can be automat in application level by setting the AutomationId. It can be set using ItemAppearing event for the ListViewItem like below code snippet.


public partial class GroupingPage : ContentPage 
        public GroupingPage() 
            listView.ItemAppearing += ListView_ItemAppearing; 
        private void ListView_ItemAppearing(object sender, ItemAppearingEventArgs e) 
            var layout = listView.LayoutManager as LinearLayout; 
            var rowItems = layout.GetType().GetRuntimeFields().First(p => p.Name =="items").GetValue(layout) as IList; 
            foreach (ListViewItemInfo iteminfo in rowItems) 
                if (iteminfo.Element != null && iteminfo.Element.AutomationId == null) 
                    iteminfo.Element.AutomationId = "ID"; 



Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment