0

I have windows phone solution ; which contain two c# projects. I have a button in one in the pages in the first project ; which we redirect the user to another page in the second solution. How to redirect to a page which exists in specif project to another page in other project in the same solution ? since we use the following code to redirect between the pages in the same project.

NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
Lotus 90
  • 41
  • 7

1 Answers1

0

If you are referencing the other project, you can use the following method:

NavigationService.Navigate(new Uri("/YourOtherProjectName;component/TargetPage.xaml", UriKind.Relative));

EDIT: If anyone is interested, I've put a sample project on Github: https://github.com/tpetrina/blogcode/tree/master/BlogResearch. WP7 application project is called NavigateToLibraryPage and it contains a single button that navigates to the page in the referenced class library named wp7.library

Toni Petrina
  • 7,014
  • 1
  • 25
  • 34
  • What is the component ? is it a key word ? – Lotus 90 May 14 '13 at 11:57
  • Yes it is. This is standard URI notation. – Toni Petrina May 14 '13 at 12:00
  • I write the following : NavigationService.Navigate(new Uri("/NewsFeed;component/MainPage.xaml", UriKind.Relative)); The exception is : An exception of type 'System.InvalidOperationException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary – Lotus 90 May 15 '13 at 09:56
  • I reference it and the redirect to the page in the second app. but when I click on a button in the page I redirect to it ; it's give exception. Even the code before put it in the solution was run correctly – Lotus 90 May 15 '13 at 12:26
  • I see it. and the redirect is working with me. my problem now is not in the redirect. when I redirect from project A to B ; project B don't work after I redirect to it. but If I run it as sperated project it's work well. In other words ; my project functionality doesn't work work after I redirect it from another project. – Lotus 90 May 19 '13 at 15:25
  • You mean from one application to another? Instead of from one application to class library. – Toni Petrina May 19 '13 at 17:59
  • Yes. from application to another application – Lotus 90 May 23 '13 at 11:41
  • This can only be done on windows phone 8 using URI associations. Take a look at this http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206987(v=vs.105).aspx. – Toni Petrina May 23 '13 at 12:39