如何打开一个新的页面

本文关键字:一个 何打开 | 更新日期: 2023-09-27 18:11:54

我试着到处研究,所有我得到的是如何打开和关闭表单。我正在制作一个XAML Windows 8 c#应用程序,我需要它从点击MainPage.xaml中的按钮显示Menu.xaml

按钮在这里:

<Button Content="Agree" HorizontalAlignment="Left" Margin="340,506,0,0"    VerticalAlignment="Top" Height="46" Width="392" Click="Button_Click_1"/>

这是由Visual Studio在MainPage.xaml.cs中生成的代码,当我在设计模式下双击按钮

private void Button_Click_1(object sender, RoutedEventArgs e)
    {
    }

如何打开一个新的页面

不像普通的WPF应用程序只允许你在屏幕上添加用户控件和窗口,市场应用程序(我假设你正在谈论)需要你在XAML页面之间"导航"。以下是您需要的程序大纲http://www.markermetro.com/2011/11/technical/windows-8-metro-style-apps-implementing-navigation-with-xaml/

这是一个基本的例子,但你应该阅读链接

       void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(AboutView).FullName);
        }