在从一个页面重定向到我的另一个页面期间,我面临以下异常。
无法创建类型为“Microsoft.Phone.Shell.PhoneApplicationService”的实例 [行:38 位置:23]
第一页下面的代码:
NavigationService.Source = (new Uri("/SecondPage.xaml?selectedItem=" + myId, UriKind.RelativeOrAbsolute));
在上面的 uri 的帮助下,我正在调用我的第二页。根据stackOverflow中提供的一些解决方案,我的xaml页面中有问题,我粘贴在我的xaml页面代码下方。
SupportedOrientations="PortraitOrLandscape"
shell:SystemTray.IsVisible="True" Loaded="PhoneApplicationPage_Loaded"
tools:TiltEffect.IsTiltEnabled="True" Orientation="Portrait" >
<phone:PhoneApplicationPage.Resources>
<shell:ApplicationBar x:Key="SettingsBar" IsVisible="True" Mode="Default">
<shell:ApplicationBarIconButton x:Name="btnHome" IconUri="Images/home.png" Text="home" Click="btnHome_Click" />
<shell:ApplicationBarIconButton x:Name="cot" IconUri="Images/toc.png" Text="toc" Click="btnToc_Click"/>
<shell:ApplicationBarIconButton x:Name="zoom" IconUri="Images/zoom.png" Text="zoom" Click="btnZoom_Click"/>
<shell:ApplicationBarIconButton x:Name="setting" IconUri="Images/settings.png" Text="settings" Click="btnSettings_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem x:Name="SettingBar_wb" Click="AppMenu_wb_Click" Text="See Wordbank" />
<shell:ApplicationBarMenuItem x:Name="SettingBar_sn" Click="AppMenu_sn_Click" Text="See Notes, " />
<shell:ApplicationBarMenuItem x:Name="SettingBar_hight" Click="AppMenu_hight_Click" Text="See Highlight" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
<shell:ApplicationBar x:Key="AnnotatorBar" IsVisible="True" >
<shell:ApplicationBarIconButton x:Name="notes" IconUri="Images/notes.png" Text="note" Click="btnNote_Click" />
<shell:ApplicationBarIconButton x:Name="myhights" IconUri="Images/myghights.png" Text="highlight" Click="btnHighlight_Click"/>
<shell:ApplicationBarIconButton x:Name="definsed" IconUri="Images/definesed.png" Text="Define" Click="btnDefine_Click"/>
<shell:ApplicationBarIconButton x:Name="webs" IconUri="Images/webs.png" Text="wordbank" Click="btnWordbank_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem x:Name="AppMenu_SeeWordBank" Click="AppMenu_SeeWordBank_Click" Text="See Wordbank" />
<shell:ApplicationBarMenuItem x:Name="AppMenu_SeeNotes" Click="AppMenu_SeeNotes_Click" Text="See Notes, " />
<!--following is line 38 -->
<shell:ApplicationBarMenuItem x:Name="AppMenu_SeeHighlights" Click="AppMenu_SeeHighlights_Click" Text="See Highlight" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
在 App.g.cs 中面临异常
System.Windows.Application.LoadComponent(this, new System.Uri("/dbok;component/App.xaml", System.UriKind.Relative));