【问题标题】:WP 7.5: Navigate from cs file to xaml file in libraryWP 7.5:从 cs 文件导航到库中的 xaml 文件
【发布时间】:2013-10-29 15:22:10
【问题描述】:

我必须写一个库。该库包含他自己的 xaml 视图。 现在,用户可以调用方法“startLibrary(NavigationService service)”。此方法不包含 PhoneApplicationPage。这就是我有参数 NavigationSerivce 的原因。

现在,我想导航到我的库视图:

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

但我总是收到错误“无效的 URI:无法确定 URI 的格式。”

重要的是说只有库可以导航到视图,不能导航到APP!

这样做的正确方法是什么?

【问题讨论】:

  • 你可以试试new Uri("/SurveyView.xaml",UriKind.Relative)

标签: windows-phone-7


【解决方案1】:

您通常使用以下语法进行导航:

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

如果页面在另一个程序集中,请使用以下语法

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

【讨论】:

    【解决方案2】:

    试试这个

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

    它会起作用的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-05
      • 2014-11-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多