在我的主網頁我嘗試導航到另一個頁面(這是一個全景頁),我的炫魅的C#代碼,如何導航到Windows Phone中的全景頁面?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace Panoramatry
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
displsy();
}
public void display()
{
NavigationService.Navigate(new Uri("/GettingStarted.xaml",UriKind.Relative));
}
}
}
而且我GettingStarted.xaml頁具有下面的代碼,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace Panoramatry
{
public partial class GettingStarted : PhoneApplicationPage
{
public GettingStarted()
{
InitializeComponent();
display();
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
display();
}
public void display()
{
MessageBox.Show("Navigation Success");
}
}
}
但在執行的炫魅我得到以下錯誤的導航代碼,
An exception of type 'System.NullReferenceException' occurred in Panoramatry.DLL but was not handled in user code
但是,當我使用主頁上的按鈕,並將此導航添加到其單擊事件時,它的工作原理非常好! 可能是什麼問題? 在此先感謝!
我從來沒有聽說過Panoramatry.DLL,您有什麼第三方庫你的解決方案最重要的是,哪些在GettingStarted.xaml中被引用? – FunksMaName
@FunksMaName 沒有第三個patry庫! – Aju
嘗試兩件事,當你離開顯示器();打電話,你是否仍然有同樣的問題?如果沒有,則將顯示移動到OnNavigatedTo事件塊中,以查看錯誤是否仍在拋出protected override void OnNavigatedTo(NavigationEventArgs e) MessageBox.Show(「Navigation Success」); (e); } – FunksMaName