|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
| 4 | + xmlns:syncfusion="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView" |
| 5 | + xmlns:data="clr-namespace:Syncfusion.Maui.DataSource;assembly=Syncfusion.Maui.DataSource" |
| 6 | + xmlns:local="clr-namespace:ListViewMaui;assembly=ListViewMaui" |
| 7 | + x:Class="ListViewMaui.MainPage"> |
| 8 | + |
| 9 | + <ContentPage.Resources> |
| 10 | + <local:InverseBoolConverter x:Key="inverseBoolConverter" /> |
| 11 | + </ContentPage.Resources> |
| 12 | + |
| 13 | + <ContentPage.BindingContext> |
| 14 | + <local:ViewModel /> |
| 15 | + </ContentPage.BindingContext> |
| 16 | + |
| 17 | + <Grid RowSpacing="0"> |
| 18 | + <Grid.RowDefinitions> |
| 19 | + <RowDefinition Height="40" /> |
| 20 | + <RowDefinition Height="*" /> |
| 21 | + </Grid.RowDefinitions> |
| 22 | + <Grid BackgroundColor="#2196F3"> |
| 23 | + <Label Text="To Do Items" x:Name="headerLabel" TextColor="White" FontAttributes="Bold" VerticalOptions="Center" HorizontalOptions="Center" /> |
| 24 | + </Grid> |
| 25 | + <syncfusion:SfListView x:Name="listView" Grid.Row="1" ScrollBarVisibility="Never" |
| 26 | + GroupHeaderSize="50" |
| 27 | + ItemSize="60" |
| 28 | + BackgroundColor="#FFE8E8EC" |
| 29 | + ItemsSource="{Binding ToDoList}" |
| 30 | + DragStartMode="OnHold,OnDragIndicator" |
| 31 | + SelectionMode="None"> |
| 32 | + <syncfusion:SfListView.DataSource> |
| 33 | + <data:DataSource> |
| 34 | + <data:DataSource.GroupDescriptors> |
| 35 | + <data:GroupDescriptor PropertyName="CategoryName" /> |
| 36 | + </data:DataSource.GroupDescriptors> |
| 37 | + </data:DataSource> |
| 38 | + </syncfusion:SfListView.DataSource> |
| 39 | + <syncfusion:SfListView.GroupHeaderTemplate> |
| 40 | + <DataTemplate> |
| 41 | + <Grid> |
| 42 | + <Label Text="{Binding Key}" FontSize="14" TextColor="#333333" FontAttributes="Bold" VerticalOptions="Center" HorizontalOptions="Start" Margin="15,0,0,0" /> |
| 43 | + </Grid> |
| 44 | + </DataTemplate> |
| 45 | + </syncfusion:SfListView.GroupHeaderTemplate> |
| 46 | + <syncfusion:SfListView.ItemTemplate> |
| 47 | + <DataTemplate> |
| 48 | + <Grid BackgroundColor="White"> |
| 49 | + <Grid.ColumnDefinitions> |
| 50 | + <ColumnDefinition Width="70" /> |
| 51 | + <ColumnDefinition Width="*" /> |
| 52 | + <ColumnDefinition Width="60" /> |
| 53 | + </Grid.ColumnDefinitions> |
| 54 | + <Grid Padding="25,20,25,20" > |
| 55 | + <Grid.GestureRecognizers> |
| 56 | + <TapGestureRecognizer Command="{Binding Path=BindingContext.MarkDoneCommand, Source={x:Reference Name=listView}}" CommandParameter="{Binding .}"/> |
| 57 | + </Grid.GestureRecognizers> |
| 58 | + <Image Source="checked.png" HorizontalOptions="Center" VerticalOptions="Center" Aspect="AspectFill" IsVisible="{Binding IsDone}"/> |
| 59 | + <Image Source="unchecked.png" HorizontalOptions="Center" VerticalOptions="Center" Aspect="AspectFill" |
| 60 | + IsVisible="{Binding IsDone, Converter={StaticResource inverseBoolConverter}}"/> |
| 61 | + </Grid> |
| 62 | + <Label x:Name="textLabel" Text="{Binding Name}" Grid.Column="1" FontSize="15" TextColor="#333333" VerticalOptions="Center" HorizontalOptions="Start" Margin="5,0,0,0" /> |
| 63 | + <BoxView Grid.Column="1" Margin="5,3,0,0" BackgroundColor="#333333" HeightRequest="1" WidthRequest="{Binding Source={x:Reference textLabel}, Path=Width}" |
| 64 | + VerticalOptions="Center" HorizontalOptions="Start" IsVisible="{Binding IsDone}" /> |
| 65 | + <syncfusion:DragIndicatorView Grid.Column="2" ListView="{x:Reference listView}" HorizontalOptions="Center" VerticalOptions="Center"> |
| 66 | + <Grid Padding="10, 20, 20, 20"> |
| 67 | + <Image Source="dragindicator.png" VerticalOptions="Center" HorizontalOptions="Center" /> |
| 68 | + </Grid> |
| 69 | + </syncfusion:DragIndicatorView> |
| 70 | + </Grid> |
| 71 | + </DataTemplate> |
| 72 | + </syncfusion:SfListView.ItemTemplate> |
| 73 | + </syncfusion:SfListView> |
| 74 | + </Grid> |
| 75 | + |
| 76 | +</ContentPage> |
0 commit comments