2013-12-21 65 views
0

導航到一個頁面我有這樣的代碼在我的用戶:TypeLoadException從用戶控件

Private Sub tap(sender As Object, e As TappedRoutedEventArgs) Handles Me.Tapped 
    Try 
     CType(Window.Current.Content, Frame).Navigate(GetType(calendar_day)) 
     'calendar_day is a page in project' 
    Catch ex As Exception 
     Debug.WriteLine(ex.HelpLink) 
     Debug.WriteLine(ex.HResult) 
     Debug.WriteLine(ex.InnerException) 
     Debug.WriteLine(ex.Message) 
     Debug.WriteLine(ex.Source) 
     Debug.WriteLine(ex.StackTrace) 
    End Try 
End Sub 

輸出:

A first chance exception of type 'System.TypeLoadException' occurred in Organize.exe 

-2146233054 

Could not find Windows Runtime type 'Windows.Foundation'. 
mscorlib  
at System.StubHelpers.WinRTTypeNameConverter.GetTypeFromWinRTTypeName(String typeName, Boolean& isPrimitive) 
at System.StubHelpers.SystemTypeMarshaler.ConvertToManaged(TypeNameNative* pNativeType, Type& managedType) 
at Windows.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType) 
at Organize.day_btn.clicked(Object sender, TappedRoutedEventArgs e) 

我試圖清理,改造,建設兩個x64和x86,但沒有什麼幫助。

回答

2

我第一次創建calendar_day爲BlankPage1,然後重命名文件和類。但是在calendar_day.xaml中,我離開了x:Class="Organize.BlankPage1"

+0

感謝您的提示。我有一個類似的錯誤,原因是Page類應該存在於Views命名空間中。 – Silverstein