畫面一
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button Name="btn_goto" Content="Button" HorizontalAlignment="Left" Margin="320,158,0,0" VerticalAlignment="Top" Width="234" />
</Grid>
</Page>
畫面一程式碼
using Windows.UI.Xaml.Controls;
// 空白頁項目範本已記錄在 https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x404
namespace App1
{
/// <summary>
/// 可以在本身使用或巡覽至框架內的空白頁面。
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.btn_goto.Click += (s, e) =>
{
this.Frame.Navigate(typeof(BlankPage1));
};
}
}
}
畫面二
<Page
x:Class="App1.BlankPage1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock HorizontalAlignment="Left" Margin="257,303,0,0" TextWrapping="Wrap" Text="Hi" VerticalAlignment="Top" Height="179" Width="335" />
</Grid>
</Page>
執行結果:
畫面一
畫面二