簡體   English   中英

Windows Phone App的應用程序欄未在模擬器中顯示

[英]Application Bar for Windows Phone App is not showing in Emulator

我正在嘗試為Windows Phone Silverlight應用程序創建應用程序欄。 我已經多次檢查了此代碼。 我沒有看到錯誤。 甚至我也檢查了MSDN的網站。 但是,當我在Emulator上運行此程序時,應用程序欄未顯示。

我的代碼有什么問題?

    <phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar Mode="Default"  Opacity="1.0" IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Assets/ApplicationBar/next.png" Text="Next" Click="appBar_next"/>
        <shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

這是完整的XAML代碼:

<phone:PhoneApplicationPage
x:Class="Share_Bills.getPersonNum"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel Grid.Row="0" Margin="12,17,0,28">
        <TextBlock Text="SHARE BILLS" Style="{StaticResource PhoneTextNormalStyle}"/>
        <TextBlock Text="step 1" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="How many persons are you?" VerticalAlignment="Top" Margin="10,0,0,0" Height="53" Width="436"/>
        <TextBox x:Name="personNum" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="456" Margin="0,25,0,0" InputScope="Number"/>
        <Button x:Name="btnNext1" Content="Next" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="326,97,0,0" Width="130" Click="btnNext1_Click"/>
        <TextBlock x:Name="txtError" HorizontalAlignment="Left" Margin="10,102,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="311" Height="134"/>
    </Grid>

</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar Mode="Default"  Opacity="1.0" IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Assets/ApplicationBar/next.png" Text="Next" Click="appBar_next"/>
        <shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar></phone:PhoneApplicationPage>

我編譯了您的項目,它與ApplicationBar一起正常工作。 最初,您將Project Entry Point設置為MainPage.xaml ,但是您在Code中提到了getPersonNum.xaml頁面的問題。 我運行了getPersonNum.xaml

這是我的模擬器的屏幕截圖:

在此處輸入圖片說明

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM