2013-08-28 96 views

回答

1

您可以在App.xaml中定義appbar這樣的..

<Application.Resources> 
    <local:LocalizedStrings xmlns:local="clr-namespace:PhoneApp12" x:Key="LocalizedStrings"/> 
    <shell:ApplicationBar x:Key="GlobalAppBar" IsVisible="True" IsMenuEnabled="True" BackgroundColor="Black" ForegroundColor="White"> 
     <shell:ApplicationBarIconButton x:Name="asd" IconUri="/1.png" Text="0" /> 
     <shell:ApplicationBarIconButton IconUri="/1.png" Text="1" /> 
     <shell:ApplicationBarIconButton IconUri="/1.png" Text="2" /> 
     <shell:ApplicationBarIconButton IconUri="/1.png" Text="3" /> 
    </shell:ApplicationBar> 
</Application.Resources> 

,並在您的XAML頁面添加此。

ApplicationBar = "{StaticResource GlobalAppBar}" 

所以你page.xaml上部看起來像這樣..

<phone:PhoneApplicationPage 
x:Class="PhoneApp12.MainPage" 
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" 
mc:Ignorable="d" 
**ApplicationBar = "{StaticResource GlobalAppBar}"** 
FontFamily="{StaticResource PhoneFontFamilyNormal}" 
FontSize="{StaticResource PhoneFontSizeNormal}" 
Foreground="{StaticResource PhoneForegroundBrush}" 
SupportedOrientations="Portrait" Orientation="Portrait" 
shell:SystemTray.IsVisible="True"> 

希望它能幫助你..

相關問題