[英]xamarin form design in list view
How could I achieve the following, it is a list of many items.我怎样才能实现以下目标,它是许多项目的列表。 on it
在上面
and this is my code:这是我的代码:
<Label Text = "Today Appointments :" TextColor = "#2196f3" WidthRequest = "200"
HeightRequest="50" FontSize = "Small" Margin = "13" FontAttributes = "Bold" ></Label >
<ListView HasUnevenRows="True" ItemsSource="{Binding Appoitments}" RowHeight="5" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid RowDefinitions="Auto,Auto,Auto">
<Frame
BorderColor="Gray"
CornerRadius="5"
Padding="8"
HasShadow="True"
>
<StackLayout Orientation="Vertical" Padding="5">
<Label Grid.Row="0" Text="{Binding AppointmentPatientName}" TextColor="Black" FontSize="Small" FontAttributes="Bold" Margin="20" />
<Label Grid.Row="0" Grid.Column="1" Text="{Binding AppointmentDate}" TextColor="Black" FontSize="Small" FontAttributes="Bold" Margin="20" />
</StackLayout>
</Frame>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
A CollectionView offers the option to group your items in the list and create a Header for your group. CollectionView 提供了对列表中的项目进行分组并为您的组创建 Header 的选项。 Enable IsGrouped property:
启用 IsGrouped 属性:
<CollectionView IsGrouped="true" />
then add然后加
<CollectionView.GroupHeaderTemplate>
<DataTemplate>
//Your Group Header here...
<Label Text="{Binding AppoitmentsId}"
BackgroundColor="LightGray"
FontSize="Large"
FontAttributes="Bold" />
</DataTemplate>
</CollectionView.GroupHeaderTemplate>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.