我在Usercontrol中有这个代码:
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,但没有任何帮助。
答案 0 :(得分:2)
我首先将calendar_day创建为BlankPage1,然后重命名为file和class。但是在calendar_day.xaml中,我离开了x:Class="Organize.BlankPage1"
。