使用ListView
基本功能
使用MVVM架構
ViewModel 基本的參考 (Ref)
群組
- 在helper目錄下,新增 Group 自定的方法
- 調整資料來源,轉換成支援Group的 ObservableCollection
- 設定XAML頁面,指定GroupDisplay的屬性
https://github.com/jamesmontemagno/Xamarin.Forms-Monkeys/tree/master/Monkeys/Monkeys http://motzcod.es/post/94643411707/enhancing-xamarinforms-listview-with-grouping https://mallibone.com/post/xamarin.forms-grouped-listview https://github.com/xamarin/xamarin-forms-samples/tree/master/UserInterface/ListView/Grouping
如果要客製Header可參考以下文章 https://mallibone.com/post/xamarin.forms-grouped-listview
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"
BackgroundColor="Navy">
<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label Text="{Binding Key}" FontSize="Small" TextColor="Lime" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
加入Checkbox功能
Hint: 目前Xamarin官方沒有支援,可參考以下二個範例,進行實作