点击按钮导航到另一个页面

Cod*_*one 7 blend visual-studio windows-phone

我开发了Windows 移动应用程序我添加了VS blend 2015的按钮,但是没有按钮导航到选项如何绑定到我的按钮页面 sub.xaml

<Button x:Name="button" Content="Enter" Height="42" Margin="122,-113,0,0" 
     VerticalAlignment="Top" Width="144" Foreground="#FF50CBC5" 
     Background="#FF0F0E0E" HorizontalAlignment="Left"/>
Run Code Online (Sandbox Code Playgroud)

Yve*_*omb 10

超链接按钮为您提供导航到另一个页面的选项.

此屏幕截图来自Blend.

在此输入图像描述

因此,请按以下方式更改标记,包括生成的Click处理程序.

<HyperlinkButton x:Name="button" Click="HyperlinkButton_Click"
    Content="Enter" Height="42" Margin="122,-113,0,0" 
    VerticalAlignment="Top" Width="144" Foreground="#FF50CBC5" 
    Background="#FF0F0E0E" HorizontalAlignment="Left"/>
Run Code Online (Sandbox Code Playgroud)

然后在你的cs中,你需要指导导航.

// Button to navigate to sub.xaml page.
private void HyperlinkButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
    // Navigate back to sub.xaml page.
    this.Frame.Navigate(typeof(SubPage));
}
Run Code Online (Sandbox Code Playgroud)