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.
 
 
 

49 lines
2.6 KiB

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="CollectionViewDemos.Views.ThirdPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewModels="clr-namespace:CollectionViewDemos.ViewModels"
Title="ThirdPage">
<ContentPage.BindingContext>
<viewModels:MonkeysViewModel />
</ContentPage.BindingContext>
<VerticalStackLayout>
<CollectionView x:Name="mainCollectionView" ItemsSource="{Binding Monkeys}">
<CollectionView.ItemTemplate>
<DataTemplate>
<SwipeView>
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem BackgroundColor="LightGreen"
Command="{Binding Source={x:Reference mainCollectionView}, Path=BindingContext.FavoriteCommand}"
CommandParameter="{Binding}"
IconImageSource="favorite.png" Text="즐겨찾기" />
<SwipeItem BackgroundColor="LightSalmon"
Command="{Binding Source={RelativeSource AncestorType={x:Type CollectionView}}, Path=BindingContext.RemoveCommand}"
CommandParameter="{Binding}"
IconImageSource="remove.png" Text="삭제" />
</SwipeItems>
</SwipeView.LeftItems>
<Grid Padding="10"
ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto">
<Image Grid.RowSpan="2"
Aspect="AspectFill" HeightRequest="60"
Source="{Binding ImageUrl}"
WidthRequest="60" />
<Label Grid.Column="1"
FontAttributes="Bold"
Text="{Binding Name}" />
<Label Grid.Row="1" Grid.Column="1"
FontAttributes="Italic"
Text="{Binding Location}"
VerticalOptions="End" />
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ContentPage>