2015-12-22 34 views
0

我在通用的應用程序一個TopAppbar和BottomAppBar,我要創建我的Windows Phone 8的相同AppBars,這是我的代碼:一個TopAppbar和BottomAppBar對WindowsPhone的

<Page.TopAppBar> 
     <CommandBar HorizontalContentAlignment="Stretch" Background="#FF00AEEF"> 
      <CommandBar.Content > 
       <Grid> 
        <StackPanel Orientation="Horizontal" 
         HorizontalAlignment="Left"> 
         <StackPanel Orientation="Horizontal" > 
          <Image Margin="2" Height="35" Source="images/4.png" Width="35"/> 
         </StackPanel> 
         <Button VerticalAlignment="Stretch" Background="#FF00AEEF" x:Name="HomeBtn" Click="HomeBtn_Click"> 
          <StackPanel Orientation="Horizontal"> 
           <Image Source="images/berry.png" Height="35" Width="35" /> 
           <TextBlock Text="BarBerry" Foreground="White"></TextBlock> 
          </StackPanel> 
         </Button> 
        </StackPanel> 
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> 
         <Button VerticalAlignment="Stretch" Background="#FF00AEEF" Style="{StaticResource CustomButtonStyle}" Margin="5,0"> 
          <StackPanel Orientation="Horizontal"> 
           <TextBlock Text="Contact" Foreground="White"></TextBlock> 
          </StackPanel> 
         </Button> 
        </StackPanel> 
       </Grid> 
      </CommandBar.Content> 
     </CommandBar> 
    </Page.TopAppBar> 

    <Page.BottomAppBar> 
     <CommandBar Background="#eff0f2" HorizontalContentAlignment="Stretch"> 
      <CommandBar.Content> 
       <Grid HorizontalAlignment="Stretch"> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="*" /> 
         <ColumnDefinition Width="*" /> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="*" /> 
        </Grid.RowDefinitions> 
        <StackPanel Orientation="Horizontal" 
         HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch"> 
         <Image Source="images/world.png" Height="35" Width="35" Margin="5,0"/> 
         <ComboBox Margin="2" BorderThickness="0" SelectedItem="test" x:Name="combo"> 
          <ComboBoxItem Content="test" /> 
          <ComboBoxItem Content="test1" /> 
         </ComboBox> 
        </StackPanel> 
       </Grid> 
      </CommandBar.Content> 
     </CommandBar> 
    </Page.BottomAppBar> 

但問題是, ,我只得到BottomAppBar顯示,是否有可能在Windows Phone 8中定義一個頂部和底部的AppBars,我應該使用StackPanel來代替頂部的appBar嗎?

感謝您的幫助

回答

1

您不能創建熱門應用欄 Windows Phone中。因爲它們只是在Windows手機項目中定義的底層應用程序欄。所以你只能在windows phone中定義底部的應用程序欄。是的,你可以使用堆棧面板而不是頂部應用程序欄,但我認爲這不是一個好主意,在Windows Phone中實現這種功能:)。

相關問題