Reputation: 1867
I have two pages: page1.xaml and page2.xaml. I have created one button on page1.xaml; on its click event I navigate to page2.xaml. When I run the application, it fails and the debugger drops me in App.xaml.cs. Below is my code:
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
if (Debugger.IsAttached)
{
// A navigation has failed; break into the debugger
Debugger.Break();
}
}
My page1.xaml.cs code behind is:
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));
}
}
Upvotes: 1
Views: 6061
Reputation: 1867
SourcePage.xaml
bookName.Id fetching Id and of book and through bookid we will get the id on our destination page and will show the data.
NavigationService.Navigate(new Uri("/MainPage.xaml?selectedItem=" +bookName.Id, UriKind.Relative));
DestinationPage.xaml
On destination page we we will fetch the query parameter as below.
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
string dir = "Hello" + selectedItem;
}
Upvotes: 1