我有两个页面:page1.xaml和page2.xaml。我在 page1.xaml 上创建了一个按钮;在其单击事件中,我导航到page2.xaml。当我运行应用程序时,它失败了,调试器将我放到App.xaml.cs中。下面是我的代码:
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
if (Debugger.IsAttached)
{
// A navigation has failed; break into the debugger
Debugger.Break();
}
}
我的 page1.xaml.cs 代码后面是:
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
private void btnDownloded_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/DownloadedBooksPortrait.xaml", UriKind.Relative));
}
}