导航到Windows Phone 7中其他程序集中的XAML页 [英] Navigate to a XAML page in a different assembly in Windows Phone 7

查看:86
本文介绍了导航到Windows Phone 7中其他程序集中的XAML页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单独的Windows Phone类库中有一个XAML页面.该库包含在我的VS解决方案中,并从我的应用程序项目中引用.假设该页面名为 TestPage.xaml ,它位于我的库的名为 SharedPages 的根文件夹中.

I have a XAML page in a separate Windows Phone class library. The library is included in my VS solution and referenced from my app project. Let's say the page is called TestPage.xaml and it's in the root folder of my library called SharedPages.

我想使用NavigationService导航到我的应用程序中的此页面.我发现这篇帖子,建议使用以下URI格式:

I'd like to navigate to this page in my app using the NavigationService. I found this post which suggests using this URI format:

/{assemblyName};component/{pathToResource}

所以我正在尝试这样的事情:

So I'm trying something like this:

NavigationService.Navigate(new Uri("/SharedPages;component/TestPage.xaml"));

运行此命令时,出现以下异常:

When I run this I get the following exception:

仅对相对的URI(片段或以'/'开头或包含'; component/'的相对URI支持导航.

我在做什么错了?

谢谢.

推荐答案

好像需要将URI创建为相对URI.这有效:

Looks like the URI needs to be created as a relative URI. This works:

NavigationService.Navigate(new Uri("/SharedPages;component/TestPage.xaml", UriKind.Relative));

这篇关于导航到Windows Phone 7中其他程序集中的XAML页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆