我是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>
谢谢大家 享受编码!
答案 0 :(得分:0)
我在这个链接上得到了答案:https://forums.xamarin.com/discussion/95645/two-textcell-inside-listview
我的逻辑错了,我改变了解决问题的方法。我使用一个带有绑定的TextCell并解决问题