Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin-如何在ListView中打开新的ContentPage?_Xamarin_Xamarin.forms_Xamarin.forms.listview - Fatal编程技术网

Xamarin-如何在ListView中打开新的ContentPage?

Xamarin-如何在ListView中打开新的ContentPage?,xamarin,xamarin.forms,xamarin.forms.listview,Xamarin,Xamarin.forms,Xamarin.forms.listview,我有一个来自我的web服务的列表,我会这样显示它: <StackLayout HorizontalOptions="FillAndExpand"> <ListView x:Name="curso" ItemSelected="CursoView_ItemSelected"> <ListView.ItemTemplate> <DataTemplate> <ViewC

我有一个来自我的web服务的列表,我会这样显示它:

<StackLayout HorizontalOptions="FillAndExpand">
    <ListView x:Name="curso" ItemSelected="CursoView_ItemSelected">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <StackLayout Orientation="Horizontal">
                            <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
                                <Label StyleClass="Header" Text="{Binding name}" />
                            </StackLayout>
                        </StackLayout>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</StackLayout>


现在我想点击一个项目并打开一个新的内容页面

这是我的问题我的当前页面不是导航页面你可以简单地用一个新页面替换App.MainPage,但是用户将无法向后导航如果您对使用NavigationPage不感兴趣,您也可以以模式显示新页面。但是现在我的列表中有3项。我如何让他们根据用户单击的项目推送新页面?使用e.itemselected这是我的问题我的当前页面不是导航页面您可以简单地用新页面替换App.MainPage,但是用户将无法向后导航如果您对使用NavigationPage不感兴趣,您也可以以模式显示新页面。但是现在我的列表中有3项。如何让他们根据用户单击的项目推送新页面?请使用e.ItemSelected
public void CursoView_ItemSelected(object sender, ItemSelectedEventArgs e)
{
  // this assumes your current page is already contained in a NavigationPage
  Navigation.PushAsync(new MyNextPage());
}