728x90
반응형
728x170
▶ MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<SwipeView x:Name="swipeView">
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem
BackgroundColor="LightGreen"
Text="즐겨찾기"
Invoked="favoriteSwipeItem_Invoked">
<SwipeItem.IconImageSource>
<FontImageSource
FontFamily="ionicons"
Size="48"
Color="Red"
Glyph="" />
</SwipeItem.IconImageSource>
</SwipeItem>
<SwipeItem
BackgroundColor="LightPink"
Text="삭제"
Invoked="deleteSwipeItem_Invoked">
<SwipeItem.IconImageSource>
<FontImageSource
FontFamily="ionicons"
Size="48"
Color="Red"
Glyph="" />
</SwipeItem.IconImageSource>
</SwipeItem>
</SwipeItems>
</SwipeView.LeftItems>
<Grid
WidthRequest="300"
HeightRequest="60"
BackgroundColor="LightGray">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="오른쪽 밀기" />
</Grid>
</SwipeView>
</ContentPage>
728x90
▶ MainPage.xaml.cs
using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;
namespace TestProject;
/// <summary>
/// 메인 페이지
/// </summary>
public partial class MainPage : ContentPage
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainPage()
/// <summary>
/// 생성자
/// </summary>
public MainPage()
{
InitializeComponent();
this.swipeView.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().SetSwipeTransitionMode(SwipeTransitionMode.Drag);
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 즐겨찾기 스와이프 항목 호출시 처리하기 - favoriteSwipeItem_Invoked(sender, e)
/// <summary>
/// 즐겨찾기 스와이프 항목 호출시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void favoriteSwipeItem_Invoked(object sender, EventArgs e)
{
await DisplayAlert("INFORMATION", "즐겨찾기 항목을 클릭했습니다.", "확인");
}
#endregion
#region 삭제 스와이프 항목 호출시 처리하기 - deleteSwipeItem_Invoked(sender, e)
/// <summary>
/// 삭제 스와이프 항목 호출시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void deleteSwipeItem_Invoked(object sender, EventArgs e)
{
await DisplayAlert("INFORMATION", "삭제 항목을 클릭했습니다.", "확인");
}
#endregion
}
728x90
반응형
그리드형(광고전용)
댓글을 달아 주세요