You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.6 KiB

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:App.Converters"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="App.Pages.ChampionsListPage"
Title="Champions">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Add"
Command="{Binding NaviagteToChampionAddEditPageCommand}"/>
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<converters:Base64ToImage x:Key="Base64ToImageConv"/>
<ResourceDictionary>
<toolkit:SelectedItemEventArgsConverter x:Key="SelectedItemEventArgsConverter" />
</ResourceDictionary>
<Style TargetType="Button">
<Setter Property="WidthRequest">40</Setter>
<Setter Property="HeightRequest">20</Setter>
</Style>
</ContentPage.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<ListView Grid.Row="0"
ItemsSource="{Binding ChampionManagerVM.ChampionVMs}"
SelectionMode="Single">
<ListView.Behaviors>
<toolkit:EventToCommandBehavior
x:TypeArguments="SelectedItemChangedEventArgs"
EventName="ItemSelected"
Command="{Binding NavigateToChampionDetailCommand}"/>
</ListView.Behaviors>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<SwipeView Grid.Row="0">
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Delete"
BackgroundColor="{StaticResource DeleteColor}"
IsDestructive="True"/>
<SwipeItem Text="Edit"
BackgroundColor="{StaticResource EditColor}"
Command="{Binding NaviagteToChampionAddEditPageCommand}"
CommandParameter="{Binding .}"/>
</SwipeItems>
</SwipeView.RightItems>
<SwipeView.Content>
<StackLayout Orientation="Horizontal" Padding="10">
<Image Source="{Binding Path=Icon, Converter={StaticResource Base64ToImageConv}}"/>
<StackLayout Grid.Column="1">
<Label Text="{Binding Name}"/>
</StackLayout>
</StackLayout>
</SwipeView.Content>
</SwipeView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout Grid.Row="1" Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="End">
<Button Text="&lt;" Command="{Binding ChampionManagerVM.PreviousPageCommand}"/>
<Label Text="{Binding ChampionManagerVM.Index}"/>
<Label Text="/"/>
<Label Text="{Binding ChampionManagerVM.Index}"/>
<Button Text="&gt;" Command="{Binding ChampionManagerVM.NextPageCommand}"/>
</StackLayout>
</Grid>
</ContentPage>