<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;
            }

 

 

posted on 2013-01-21 16:27  桃源月色  阅读(742)  评论(0编辑  收藏  举报