<phone:PhoneApplicationPage.Resources> <shell:ApplicationBar x:Key="AppBar0" IsMenuEnabled="True" IsVisible="True" Mode="Default" Opacity="0.8" BackgroundColor="Black" ForegroundColor="White"> <shell:ApplicationBarIconButton x:Name="HotTopicsRefreshButton" Text="重新整理" IconUri="/Assets/Icons/refresh.png" Click="HotTopicsRefreshButton_Click" /> <shell:ApplicationBarIconButton x:Name="HotTopicsSearchButton" Text="搜尋" IconUri="/Assets/Icons/feature.search.png" Click="SearchButton_Click" /> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="設定" Click="SettingsButton_Click"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> <shell:ApplicationBar x:Key="AppBar1" BackgroundColor="Black" ForegroundColor="White" IsMenuEnabled="True" IsVisible="True" Mode="Default" Opacity="0.8"> <shell:ApplicationBarIconButton Text="管理" IconUri="/Assets/Icons/favs.png" Click="ManageSubwordsBtn_Click"/> <shell:ApplicationBarIconButton Text="重新整理" IconUri="/Assets/Icons/refresh.png" /> <shell:ApplicationBarIconButton Text="搜尋" IconUri="/Assets/Icons/feature.search.png" Click="SearchButton_Click" /> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="設定" Click="SettingsButton_Click"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar></phone:PhoneApplicationPage.Resources>
in cs code:
if (PhonePivot.SelectedIndex == 0) { ApplicationBar = (IApplicationBar)Resources["AppBar0"]; } else if (PhonePivot.SelectedIndex == 1) { ApplicationBar = (IApplicationBar)Resources["AppBar1"];} if (ApplicationBar != null) { ApplicationBar.BackgroundColor = System.Windows.Media.Colors.Black; ApplicationBar.ForegroundColor = System.Windows.Media.Colors.White; }