728x90
728x170
▶ CatPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.CatPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="Cat Page"
BackgroundColor="White"
Shell.PresentationMode="NotAnimated">
<StackLayout
HorizontalOptions="Center"
VerticalOptions="Center"
Spacing="10">
<Label
HorizontalOptions="Center"
Text="CAT PAGE" />
<Button x:Name="dongPageButton"
HorizontalOptions="Center"
Text="개 페이지로 이동" />
<Button x:Name="monkeyPageButton"
HorizontalOptions="Center"
Text="원숭이 페이지로 이동" />
</StackLayout>
</ContentPage>
728x90
▶ CatPage.xaml.cs
namespace TestProject;
/// <summary>
/// 고양이 페이지
/// </summary>
public partial class CatPage : ContentPage
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - CatPage()
/// <summary>
/// 생성자
/// </summary>
public CatPage()
{
InitializeComponent();
this.dongPageButton.Clicked += dongPageButton_Clicked;
this.monkeyPageButton.Clicked += monkeyPageButton_Clicked;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 개 페이지로 이동 버튼 클릭시 처리하기 - dongPageButton_Clicked(sender, e)
/// <summary>
/// 개 페이지로 이동 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void dongPageButton_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//동물/개", true);
}
#endregion
#region 원숭이 페이지로 이동 버튼 클릭시 처리하기 - monkeyPageButton_Clicked(sender, e)
/// <summary>
/// 원숭이 페이지로 이동 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void monkeyPageButton_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//동물/원숭이", true);
}
#endregion
}
300x250
▶ DogPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.DogPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="Dog Page"
BackgroundColor="White"
Shell.PresentationMode="NotAnimated">
<StackLayout
HorizontalOptions="Center"
VerticalOptions="Center"
Spacing="10">
<Label
HorizontalOptions="Center"
Text="DOG PAGE" />
<Button x:Name="catPageButton"
HorizontalOptions="Center"
Text="고양이 페이지로 이동" />
<Button x:Name="monkeyPageButton"
HorizontalOptions="Center"
Text="원숭이 페이지로 이동" />
</StackLayout>
</ContentPage>
▶ DogPage.xaml.cs
namespace TestProject;
/// <summary>
/// 개 페이지
/// </summary>
public partial class DogPage : ContentPage
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - DogPage()
/// <summary>
/// 생성자
/// </summary>
public DogPage()
{
InitializeComponent();
this.catPageButton.Clicked += catPageButton_Clicked;
this.monkeyPageButton.Clicked += monkeyPageButton_Clicked;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 고양이 페이지로 이동 버튼 클릭시 처리하기 - catPageButton_Clicked(sender, e)
/// <summary>
/// 고양이 페이지로 이동 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void catPageButton_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//동물/고양이", true);
}
#endregion
#region 원숭이 페이지로 이동 버튼 클릭시 처리하기 - monkeyPageButton_Clicked(sender, e)
/// <summary>
/// 원숭이 페이지로 이동 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void monkeyPageButton_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//동물/원숭이", true);
}
#endregion
}
▶ MonkeyPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MonkeyPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="Monkey Page"
BackgroundColor="White"
Shell.PresentationMode="NotAnimated">
<StackLayout
HorizontalOptions="Center"
VerticalOptions="Center"
Spacing="10">
<Label
HorizontalOptions="Center"
Text="MONKEY PAGE" />
<Button x:Name="catPageButton"
HorizontalOptions="Center"
Text="고양이 페이지로 이동" />
<Button x:Name="dogPageButton"
HorizontalOptions="Center"
Text="개 페이지로 이동" />
</StackLayout>
</ContentPage>
▶ MonkeyPage.xaml.cs
namespace TestProject;
/// <summary>
/// 원숭이 페이지
/// </summary>
public partial class MonkeyPage : ContentPage
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MonkeyPage()
/// <summary>
/// 생성자
/// </summary>
public MonkeyPage()
{
InitializeComponent();
this.catPageButton.Clicked += catPageButton_Clicked;
this.dogPageButton.Clicked += dogPageButton_Clicked;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 고양이 페이지로 이동 버튼 클릭시 처리하기 - catPageButton_Clicked(sender, e)
/// <summary>
/// 고양이 페이지로 이동 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void catPageButton_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//동물/고양이", true);
}
#endregion
#region 개 페이지로 이동 버튼 클릭시 처리하기 - dogPageButton_Clicked(sender, e)
/// <summary>
/// 개 페이지로 이동 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private async void dogPageButton_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync("//동물/개", true);
}
#endregion
}
▶ AppShell.xaml
<?xml version="1.0" encoding="utf-8" ?>
<Shell x:Class="TestProject.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestProject">
<FlyoutItem
Route="동물"
FlyoutDisplayOptions="AsMultipleItems">
<ShellContent
Icon="sample1.png"
Route="고양이"
Title="고양이"
ContentTemplate="{DataTemplate local:CatPage}" />
<ShellContent
Icon="sample2.png"
Route="개"
Title="개"
ContentTemplate="{DataTemplate local:DogPage}" />
<ShellContent
Icon="sample3.png"
Route="원숭이"
Title="원숭이"
ContentTemplate="{DataTemplate local:MonkeyPage}" />
</FlyoutItem>
</Shell>
728x90
그리드형(광고전용)