我怎樣才能實作以下,它是許多專案的串列。在上面
設計目標
這是我的代碼:
<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>
uj5u.com熱心網友回復:
CollectionView 提供了對串列中的專案進行分組并為您的組創建標題的選項。啟用 IsGrouped 屬性:
<CollectionView IsGrouped="true" />
然后加
<CollectionView.GroupHeaderTemplate>
<DataTemplate>
//Your Group Header here...
<Label Text="{Binding AppoitmentsId}"
BackgroundColor="LightGray"
FontSize="Large"
FontAttributes="Bold" />
</DataTemplate>
</CollectionView.GroupHeaderTemplate>
按照這個鏈接
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/458986.html
標籤:xml 列表显示 xamarin xamarin.forms
