Files
maui-linux/samples/ControlGallery/Pages/SwipeViewPage.xaml

122 lines
6.1 KiB
Plaintext
Raw Normal View History

<?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"
x:Class="ControlGallery.Pages.SwipeViewPage"
Title="SwipeView">
<VerticalStackLayout Spacing="20" Padding="20">
<Label Text="SwipeView" FontSize="24" FontAttributes="Bold" />
<Label Text="Swipe items left or right to reveal actions" TextColor="{StaticResource Gray500}" />
<ScrollView>
<VerticalStackLayout Spacing="10">
<!-- Swipe to Delete -->
<Label Text="Swipe Left to Delete" FontAttributes="Bold" Margin="0,10,0,5" />
<SwipeView>
<SwipeView.RightItems>
<SwipeItems Mode="Execute">
<SwipeItem Text="Delete"
BackgroundColor="#FF5252"
Invoked="OnDeleteInvoked" />
</SwipeItems>
</SwipeView.RightItems>
<Frame Padding="15" CornerRadius="8">
<HorizontalStackLayout Spacing="10">
<BoxView WidthRequest="40" HeightRequest="40" Color="{StaticResource Primary}" CornerRadius="20" />
<VerticalStackLayout VerticalOptions="Center">
<Label Text="Email from John" FontAttributes="Bold" />
<Label Text="Meeting tomorrow at 10am" TextColor="{StaticResource Gray500}" FontSize="12" />
</VerticalStackLayout>
</HorizontalStackLayout>
</Frame>
</SwipeView>
<!-- Swipe for Multiple Actions -->
<Label Text="Swipe Left for Multiple Actions" FontAttributes="Bold" Margin="0,10,0,5" />
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Archive"
BackgroundColor="#FFC107"
Invoked="OnArchiveInvoked" />
<SwipeItem Text="Delete"
BackgroundColor="#FF5252"
Invoked="OnDeleteInvoked" />
</SwipeItems>
</SwipeView.RightItems>
<Frame Padding="15" CornerRadius="8">
<HorizontalStackLayout Spacing="10">
<BoxView WidthRequest="40" HeightRequest="40" Color="#4CAF50" CornerRadius="20" />
<VerticalStackLayout VerticalOptions="Center">
<Label Text="Email from Sarah" FontAttributes="Bold" />
<Label Text="Project update" TextColor="{StaticResource Gray500}" FontSize="12" />
</VerticalStackLayout>
</HorizontalStackLayout>
</Frame>
</SwipeView>
<!-- Swipe Right to Favorite -->
<Label Text="Swipe Right to Favorite" FontAttributes="Bold" Margin="0,10,0,5" />
<SwipeView>
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem Text="★ Favorite"
BackgroundColor="#2196F3"
Invoked="OnFavoriteInvoked" />
</SwipeItems>
</SwipeView.LeftItems>
<Frame Padding="15" CornerRadius="8">
<HorizontalStackLayout Spacing="10">
<BoxView WidthRequest="40" HeightRequest="40" Color="#9C27B0" CornerRadius="20" />
<VerticalStackLayout VerticalOptions="Center">
<Label Text="Email from Mike" FontAttributes="Bold" />
<Label Text="Check out this article" TextColor="{StaticResource Gray500}" FontSize="12" />
</VerticalStackLayout>
</HorizontalStackLayout>
</Frame>
</SwipeView>
<!-- Bidirectional Swipe -->
<Label Text="Swipe Both Directions" FontAttributes="Bold" Margin="0,10,0,5" />
<SwipeView>
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem Text="Reply"
BackgroundColor="#4CAF50"
Invoked="OnReplyInvoked" />
</SwipeItems>
</SwipeView.LeftItems>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Forward"
BackgroundColor="#2196F3"
Invoked="OnForwardInvoked" />
<SwipeItem Text="Delete"
BackgroundColor="#FF5252"
Invoked="OnDeleteInvoked" />
</SwipeItems>
</SwipeView.RightItems>
<Frame Padding="15" CornerRadius="8">
<HorizontalStackLayout Spacing="10">
<BoxView WidthRequest="40" HeightRequest="40" Color="#FF9800" CornerRadius="20" />
<VerticalStackLayout VerticalOptions="Center">
<Label Text="Email from Boss" FontAttributes="Bold" />
<Label Text="Quarterly review scheduled" TextColor="{StaticResource Gray500}" FontSize="12" />
</VerticalStackLayout>
</HorizontalStackLayout>
</Frame>
</SwipeView>
</VerticalStackLayout>
</ScrollView>
</VerticalStackLayout>
</ContentPage>