【发布时间】:2019-08-11 13:01:09
【问题描述】:
。其中Contact1、Contact2 是models,ListView 是这些模型的列表。
现在我有这样的代码,但我没有得到想要的输出。
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="KiaiDay.Pages.ConviteEmailPage"
NavigationPage.TitleView="Convive por email"
NavigationPage.HasBackButton="True"
NavigationPage.BackButtonTitle="Voltar"
BackgroundColor="AliceBlue">
<ContentPage.Content>
<AbsoluteLayout>
<ActivityIndicator x:Name="indicador" AbsoluteLayout.LayoutBounds="0.5,0.5,100,100" AbsoluteLayout.LayoutFlags="PositionProportional" Color="Blue"/>
<StackLayout>
<ListView x:Name="ListaContactos">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Image Source="{Binding Imagem}"/>
<Label Text="{Binding Nome}"/>
<Label Text="{Binding Email}"/>
<Label Text="{Binding Numero}"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</AbsoluteLayout>
</ContentPage.Content>
</ContentPage>
【问题讨论】:
-
使用 CollectionView - docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/…
-
请记住,
CollectionView在 XF 3.6 中仍处于预览阶段,但从我的使用情况来看,它已经相当可靠了。此外,如果您只有一小部分不变的联系人集合,您可以在 `ScrollView 中使用FlexLayout。
标签: xaml xamarin layout xamarin.forms