单击按钮导航到另一个页面
Navigate to another page on button click
我正在开发 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"/>
超链接按钮让您可以选择导航到另一个页面 onclick。
此屏幕截图来自 Blend。
因此请按如下方式更改您的标记,包括生成的点击处理程序。
<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"/>
然后在你的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));
}
您将有一个按钮的 Click 事件。在该点击事件中,将代码写为
private void Button_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/sub.xaml", UriKind.RelativeOrAbsolute));
}
您可以按照以下步骤执行此操作。
第一步 - 在 window 上添加一个新按钮并根据需要更改属性。
第二步 - 双击该按钮。然后你将像这样转到cs文件。
private void Button_Click(object sender, RoutedEventArgs e)
{
}
第三步 - 创建您想要导航的 window 的新对象并打开它,然后关闭当前 window
private void Button_Click(object sender, RoutedEventArgs e)
{
NewWindow newWindow = new NewWindow();
newWindow.Show();
this.Close();
}
谢谢。
我正在开发 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"/>
超链接按钮让您可以选择导航到另一个页面 onclick。
此屏幕截图来自 Blend。
因此请按如下方式更改您的标记,包括生成的点击处理程序。
<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"/>
然后在你的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));
}
您将有一个按钮的 Click 事件。在该点击事件中,将代码写为
private void Button_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/sub.xaml", UriKind.RelativeOrAbsolute));
}
您可以按照以下步骤执行此操作。
第一步 - 在 window 上添加一个新按钮并根据需要更改属性。
第二步 - 双击该按钮。然后你将像这样转到cs文件。
private void Button_Click(object sender, RoutedEventArgs e)
{
}
第三步 - 创建您想要导航的 window 的新对象并打开它,然后关闭当前 window
private void Button_Click(object sender, RoutedEventArgs e)
{
NewWindow newWindow = new NewWindow();
newWindow.Show();
this.Close();
}
谢谢。