728x90
반응형
728x170
▶ MonkeyDetailPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MonkeyDetailPage" x:Name="contentPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="Monkey Detail Page"
BackgroundColor="White"
BindingContext="{x:Reference contentPage}">
<Shell.BackButtonBehavior>
<BackButtonBehavior
IconOverride="dotnet_bot.png"
Command="{Binding BackButtonCommand}" />
</Shell.BackButtonBehavior>
<StackLayout>
<Label x:Name="label"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
Text="MONKEY DETAIL PAGE" />
</StackLayout>
</ContentPage>
728x90
▶ MonkeyDetailPage.xaml.cs
using System.Windows.Input;
using TestProject.Models;
namespace TestProject;
/// <summary>
/// 원숭이 페이지
/// </summary>
[QueryProperty(nameof(Monkey), "monkey")]
public partial class MonkeyDetailPage : ContentPage
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Property
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 뒤로가기 버튼 명령 - BackButtonCommand
/// <summary>
/// 뒤로가기 버튼 명령
/// </summary>
public ICommand BackButtonCommand { get; private set; } = new Command
(
() =>
{
Shell.Current.Navigation.PopAsync();
}
);
#endregion
#region 원숭이 - Monkey
/// <summary>
/// 원숭이
/// </summary>
public MonkeyModel Monkey { get; set; }
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MonkeyDetailPage()
/// <summary>
/// 생성자
/// </summary>
public MonkeyDetailPage()
{
InitializeComponent();
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 표시시 처리하기 - OnAppearing()
/// <summary>
/// 표시시 처리하기
/// </summary>
protected override void OnAppearing()
{
base.OnAppearing();
if(Monkey != null)
{
this.label.Text = $"MONKEY DETAIL PAGE : {Monkey.Name}, {Monkey.Time:HH:mm:ss}";
}
else
{
this.label.Text = "MONKEY DETAIL PAGE";
}
}
#endregion
}
728x90
반응형
그리드형(광고전용)
댓글을 달아 주세요