ListView中的两个TextCell

ListView中的两个TextCell,listview,xamarin,Listview,Xamarin,我是Xamarin Forms的新手,我尝试用简单的例子学习。现在我有了masterdetailpage,我想用ListView和ListView显示菜单项,比如TextCells,但是当我编写这样的Xaml代码时,我看不到菜单项为什么 <MasterDetailPage.Master> <ContentPage BackgroundColor="AntiqueWhite" Title="Master" Icon="menuicon.png"> &

我是Xamarin Forms的新手,我尝试用简单的例子学习。现在我有了masterdetailpage,我想用ListView和ListView显示菜单项,比如TextCells,但是当我编写这样的Xaml代码时,我看不到菜单项为什么

<MasterDetailPage.Master>
    <ContentPage BackgroundColor="AntiqueWhite" Title="Master" Icon="menuicon.png">
        <ContentPage.Content>
            <StackLayout VerticalOptions="Start" HorizontalOptions="Center" Margin="0,20,0,0">
                <ListView BackgroundColor="Transparent" SeparatorVisibility="None" HasUnevenRows="True">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <ViewCell.View>
                                    <TextCell x:Name="a" Text="Page 1" TextColor="Black" Tapped="TextCell_Tapped"></TextCell>
                                    <TextCell x:Name="b" Text="Page 2" TextColor="Black" Tapped="TextCell_Tapped_1"></TextCell>
                                </ViewCell.View>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>
        </ContentPage.Content>
 </ContentPage>

谢谢大家
享受编码

我在这个链接上找到了答案:


我的逻辑是错误的,我改变了解决问题的方法。我使用一个带绑定的TextCell来解决问题

一个ViewCell只能有一个子元素。您可以将该子项设置为类似StackLayout的容器,并在其中放置多个控件。你不能把细胞相互嵌套。ListView还打算用作数据绑定控件。如果您想要硬编码项目的列表,请使用表格。