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"
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
반응형
그리드형(광고전용)
'C# > MAUI' 카테고리의 다른 글
[C#/MAUI/.NET6] XamlCompilationAttribute 클래스 : 페이지 수준에서 XAML 컴파일 활성화하기 (0) | 2022.06.15 |
---|---|
[C#/MAUI/.NET6] XamlCompilationAttribute 클래스 : 어셈블리 수준에서 XAML 컴파일 활성화하기 (0) | 2022.06.15 |
[C#/MAUI/.NET6] On 엘리먼트 : Platform 속성 사용하기 (0) | 2022.06.14 |
[C#/MAUI/.NET6] OnPlatform 엘리먼트 : Thickness 객체 설정하기 (0) | 2022.06.14 |
[C#/MAUI/.NET6] ContentPropertyAttribute 클래스 사용하기 (0) | 2022.06.14 |
[C#/MAUI/.NET6] dotnet restore 명령 : 종속성 복원하기 (0) | 2022.06.14 |
[C#/MAUI/.NET6] 플랫폼간 API 호출하기 (ANDROID) (IOS) (0) | 2022.06.12 |
[C#/MAUI/.NET6] IGeolocation 인터페이스 : GetLastKnownLocationAsync 메소드를 사용해 가장 최근 GPS 위치 구하기 (ANDROID) (0) | 2022.06.11 |
[C#/MAUI/.NET6] ISecureStorage 인터페이스 : RemoveAll 메소드를 사용해 보안 저장소에서 모든 값 제거하기 (0) | 2022.06.11 |
[C#/MAUI/.NET6] ISecureStorage 인터페이스 : Remove 메소드를 사용해 보안 저장소에서 값 제거하기 (0) | 2022.06.11 |
댓글을 달아 주세요