Navigate to a new page from my API ID

I understand this should be easier using listview but my design wasn't getting along too well with it so I needed to use something else, this is what I have:

<StackLayout BindableLayout.ItemsSource="{Binding Posts}">
                <BindableLayout.ItemTemplate>
                    <DataTemplate>

                        <Grid Margin="5" RowSpacing="0" x:Name="postsTable">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="200"/>
                            </Grid.RowDefinitions>

                            <ImageButton Grid.Column="0" Grid.ColumnSpan="2" Source="{Binding postImage}"  VerticalOptions="Fill" HorizontalOptions="Fill" Aspect="AspectFill" Command="{Binding OpenPageCommand}"/>
                            <StackLayout Grid.Column="0" Grid.ColumnSpan="2" VerticalOptions="End" HorizontalOptions="Start" Margin="10">
                                <Label Text="{Binding title}" FontFamily="{StaticResource BoldFont}" StyleClass="titlesqr"/>
                                <Label Text="{Binding subtitle}" FontFamily="{StaticResource NormalFont}" StyleClass="textsqr"/>
                            </StackLayout>
                        </Grid>

                    </DataTemplate>
                </BindableLayout.ItemTemplate>

            </StackLayout>

How can I open a new contentpage making an API query with the post ID of the pressed item? my api call should be something like "https://domain.com/posts/" + id;

I don't quite understand how do I get and pass the id from the itemtemplate

Answers

Sign In or Register to comment.