1 在window 的設計的時候 ,中間需要進行頁面切換的時候,頂一個Frame
<Frame Name="MainPage" NavigationUIVisibility="Hidden" Grid.RowSpan="1" Grid.Row="0" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" VerticalContentAlignment="Top">
</Frame>
2 頁面的跳轉
</pre><pre name="code" class="csharp"> MapPage page = new MapPage(this);
//SystemPage page = new SystemPage(this);
MainPage.Content = page;
3 隐藏系統自帶的前進,回退導航
A . xmal 設定
NavigationUIVisibility="Hidden"
B C#代碼設定
MainPage.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
4 自定義按鈕 ,實作前進和後退
void back_btn_click(object sender, MouseEventArgs e)
{
Console.WriteLine("點了back按鈕!");
if (page.NavigationService.CanGoBack)
{
page.NavigationService.GoBack();
}
}
void next_btn_click(object sender, MouseEventArgs e)
{
Console.WriteLine("點了next按鈕!");
if (page.NavigationService.CanGoForward)
{
page.NavigationService.GoForward();
}
}