【发布时间】:2014-11-23 20:52:48
【问题描述】:
我需要从 Class1.cs 导航到 Page1.xaml。
我在 MainPage.cs 上尝试过这种方式
public void test()
{
NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
}
并在 Class1.cs 中访问它:
...
MainPage window = new MainPage();
window.test();
....
但我明白了:
"[System.NullReferenceException]
{System.NullReferenceException: Object reference not set to an
instance of an object."
在 NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
已经读过这个:How to navigate to a xaml page from class,但是没有用。
任何帮助我该怎么做?
PS:Class1.cs 和 Page1.cs 有不同的命名空间,如果重要的话。
【问题讨论】:
标签: windows-phone-8 nullreferenceexception