첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.16MB

▶ MonkeyDetailViewModel.cs

using System.Windows.Input;

namespace TestProject.ViewModels;

/// <summary>
/// 원숭이 상세 뷰 모델
/// </summary>
public class MonkeyDetailViewModel
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Property
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 뒤로가기 버튼 명령 - BackButtonCommand

    /// <summary>
    /// 뒤로가기 버튼 명령
    /// </summary>
    public ICommand BackButtonCommand { get; private set; }

    #endregion

    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - MonkeyDetailViewModel()

    /// <summary>
    /// 생성자
    /// </summary>
    public MonkeyDetailViewModel()
    {
        BackButtonCommand = new Command
        (
            () =>
            {
                Shell.Current.Navigation.PopAsync();
            }
        );
    }

    #endregion
}

 

728x90

 

▶ MonkeyDetailPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MonkeyDetailPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:viewmodel="clr-namespace:TestProject.ViewModels"
    Title="Monkey Detail Page"
    BackgroundColor="White">
    <ContentPage.BindingContext>
        <viewmodel:MonkeyDetailViewModel />
    </ContentPage.BindingContext>
    <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
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요