【发布时间】:2013-09-15 10:22:05
【问题描述】:
我有一个自定义组件项目,我指的是另一个项目。
我需要在自定义组件的页面之间导航,所以我使用了这段代码:
var frame = Application.Current.RootVisual as PhoneApplicationFrame;
frame.Navigate(new Uri("/CustomComponent;component/Page.xaml", UriKind.Relative));
现在,假设我的自定义组件具有这样的结构:
Root Folder
\_ Page.xaml
\_ Folder A
\_ BaseClass.cs
\_ Folder B
\_ Folder C
\_ Class.cs (extends BaseClass)
\_ Page2.xaml
我想在Class.cs 中调用一个方法,该方法返回一个字符串,允许我使用我发布的导航代码导航到Page2.xaml。
所以,这个方法应该返回
/CustomComponent;component/文件夹B/文件夹C/Page2.xaml
(/CustomComponent;component/ 是可选的,但我需要它来返回正确的文件夹结构以导航到页面)
我一直在尝试使用 Directory 类,但 GetCurrentDirectory() 方法返回指向应用程序安装文件夹的绝对路径,我需要它是遵循组件结构的相对路径。
【问题讨论】:
标签: c# xaml windows-phone-8 navigation uri