2013-10-29 58 views
0

我必須編寫一個庫。該庫包含他自己的xaml視圖。 現在,用戶可以調用方法「startLibrary(NavigationService service)」。此方法不包含PhoneApplicationPage。這就是爲什麼我有參數NavigationSerivce。WP 7.5:從cs文件導航到庫中的xaml文件

現在,我想轉到我的媒體庫視圖:

service.Navigate(new Uri("/SurveyView.xaml")); 

但我總是得到錯誤「無效的URI:URI的格式無法確定。」

重要的是要說只有圖書館可以導航到視圖,而不是APP!

什麼是正確的方法來做到這一點?

+1

你可以試試'new Uri(「/ SurveyView.xaml」,UriKind.Relative)' –

回答

0

通常你導航使用的語法如下:

NavigationService.Navigate(new Uri("/page.xaml", UriKind.Relative)); 

如果一個頁面是在另一個程序集,請使用以下語法

NavigationService.Navigate(new Uri("/AssemblyName;component/page.xaml", UriKind.Relative)); 
0

試試這個

((PhoneApplicationFrame)Application.Current.RootVisual).Navigate(new Uri("/SurveyView.xaml", UriKind.Relative)); 

它將工作。

相關問題