Forum Xamarin.Forms

Custom Listview With ViewCell Item Click (Button) Navigation To Specific Page

osamajuttosamajutt Member ✭✭

I'm Using a Custom Listview which Contains ViewCell. I have a Button inside my Each ViewCell as Shown below in the Picture. I want , when a user clicks a Button in a Row , He should Navigate to Specific Page..... Please Help Me Solving This Problem . I Have also attached the ScreenShot..Please Check


  • jda996jda996 Member

    Hello I need to do something like this as well anybody has an answer?

    I have a view like this:

                    <controls:HorizontalScrollView HeightRequest="160" 
                                           ItemsSource="{Binding OwnerServicesList}"
                                <StackLayout Margin="10,0,5,0" WidthRequest="100" HeightRequest="100">
                                        <Image HorizontalOptions="Start"  Source="{Binding ImgUrl}" WidthRequest="100" HeightRequest="100" />
                                        <Label Style="{StaticResource BoldLabel}" HorizontalTextAlignment="Center" FontSize="13" LineBreakMode="TailTruncation" Text="{Binding Name}" TextColor="Black"/>

    Im using a custom made controller for a Horizontal Scroll view that works like a listview, every itemon tap raises a ItemTappedEventArgs event.

    Inside my model i´ve declared a public Page Page { get; set; } for each object in the scroll view.

    What im trying to do is recover the tapped element and recover the Page stored in it so that I can Navigate to that specific page.

    So far I have something like this:

    private void OwnerServicesSlider_ItemSelected(object sender, ItemTappedEventArgs e)
                var service = OwnerServicesSlider.SelectedItem as Services;   

    It shows no errors but when I run it I get a InvalidOperationException: 'Page must not already have a parent.'

    Any hint will be appreciated!

Sign In or Register to comment.