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

TestProject.zip
0.15MB

▶ 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"
    Title="메인 페이지">
    <Button x:Name="moveButton"
        HorizontalOptions="Center"
        VerticalOptions="Center"
        Text="두번째 페이지 이동하기" />
</ContentPage>

 

728x90

 

▶ MainPage.xaml.cs

namespace TestProject;

/// <summary>
/// 메인 페이지
/// </summary>
public partial class MainPage : ContentPage
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - MainPage()

    /// <summary>
    /// 생성자
    /// </summary>
    public MainPage()
    {
        InitializeComponent();

        this.moveButton.Clicked += moveButton_Clicked;
    }

    #endregion

    //////////////////////////////////////////////////////////////////////////////////////////////////// Method
    ////////////////////////////////////////////////////////////////////////////////////////// Private

    #region 두번째 페이지 이동하기 - moveButton_Clicked(sender, e)

    /// <summary>
    /// 두번째 페이지 이동하기
    /// </summary>
    /// <param name="sender">이벤트 발생자</param>
    /// <param name="e">이벤트 인자</param>
    private async void moveButton_Clicked(object sender, EventArgs e)
    {
        await Navigation.PushAsync(new SecondPage());
    }

    #endregion
}

 

300x250

 

▶ SecondPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.SecondPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    Title="두번째 페이지">
    <Label
        HorizontalOptions="Center"
        VerticalOptions="Center" 
        Text="두번쨰 페이지" />
</ContentPage>

 

반응형

 

▶ SecondPage.xaml.cs

namespace TestProject;

/// <summary>
/// 두번째 페이지
/// </summary>
public partial class SecondPage : ContentPage
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - SecondPage()

    /// <summary>
    /// 생성자
    /// </summary>
    public SecondPage()
    {
        InitializeComponent();
    }

    #endregion
}

 

▶ App.xaml

<?xml version = "1.0" encoding = "UTF-8" ?>
<Application x:Class="TestProject.App"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" />

 

▶ App.xaml.cs

namespace TestProject;

/// <summary>
/// 앱
/// </summary>
public partial class App : Application
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - App()

    /// <summary>
    /// 생성자
    /// </summary>
    public App()
    {
        InitializeComponent();

        NavigationPage navigationPage = new NavigationPage(new MainPage());

        navigationPage.BarTextColor = Colors.White;

        MainPage = navigationPage;
    }

    #endregion
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요