We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to make navigation for a corresponding tapped item named page in Xamarin.Forms ListView (SfListView)

Platform: Xamarin.Forms |
Control: SfListView

You can navigate to the particular xaml page based on the tapped item data (name of the page) using Activator.CreateInstance in Xamarin.Forms SfListView.


Defined TapCommand in ListView.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
        <local:ContactsViewModel x:Name="viewModel"/>
            <listView:SfListView x:Name="list" TapCommand="{Binding OpenXamlPage}" ItemsSource="{Binding ContactsInfo}" SelectionMode="Single" AutoFitMode="DynamicHeight">
                    <DataTemplate x:Name="ItemTemplate" >
                            <Grid x:Name="grid" RowSpacing="1">
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="1" />
                                <Grid RowSpacing="1">
                                        <ColumnDefinition Width="50" />
                                        <ColumnDefinition Width="*" />
                                    <Image Source="{Binding ContactImage}" VerticalOptions="Center" HorizontalOptions="Center" HeightRequest="50"/>
                                    <Grid Grid.Column="1" VerticalOptions="Center">
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="*" />
                                        <Label Text="{Binding ContactName}"/>
                                        <Label Grid.Row="1" Grid.Column="0" Text="{Binding ContactNumber}"/>
                                <StackLayout Grid.Row="1" BackgroundColor="Black" HeightRequest="1"/>


Using Activator.CreateInstance to navigate to created page instance dynamically.

namespace ListViewXamarin
    public class ContactsViewModel : INotifyPropertyChanged
        public ObservableCollection<Contacts> ContactsInfo { get; set; }
        public Command OpenXamlPage { get; set; }
        public ContactsViewModel()
            OpenXamlPage = new Command(OnOpenXamlPage);
            ContactsInfo = new ObservableCollection<Contacts>();
            Random r = new Random();
            for (int i = 0; i < CustomerNames.Length; ++i) 
                var contact = new Contacts(CustomerNames[i], r.Next(720, 799).ToString() + " - " + r.Next(3010, 3999).ToString());
                contact.ContactImage = ImageSource.FromResource("ListViewXamarin.Images.Image" + i + ".png", typeof(MainPage));
        private void OnOpenXamlPage(object e)
            string page = ((e as Syncfusion.ListView.XForms.ItemTappedEventArgs).ItemData as Contacts).ContactName;
            //"{namespace}.{class name}, {assembly name}"
            //Example "ListViewXamarin.Views.Katie, ListViewXamarin"
            string pageStr = "ListViewXamarin.Views." + page + ", ListViewXamarin";
            var objType = Type.GetType(pageStr);
            var newPage = Activator.CreateInstance(objType) as ContentPage;
            newPage.BindingContext = (e as Syncfusion.ListView.XForms.ItemTappedEventArgs).ItemData as Contacts;
        string[] CustomerNames = new string[] {
        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(string name)
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(name));


Navigate using Activator.CreateInstance

View sample in GitHub

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile