First, define two ApplicationBar on the XAML page:
<phone:PhoneApplicationPage.Resources> <shell:applicationbar isvisible="True"Ismenuenabled="True"x:key="appBar0"Mode="Default"> <shell:applicationbariconbutton text="AppBarBtn0"Iconuri="Appbarbtn0.png"click="Appbarbtn0_click"/> <shell:ApplicationBar.MenuItems> <shell:applicationbarmenuitem text="appBarMenu0"click="Appbarmenu0_click"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> <shell:application Bar isvisible="True"Ismenuenabled="True"x:key="appBar1"Mode="Default"> <shell:applicationbariconbutton text="APPBARBTN1"Iconuri="Appbarbtn1.png"click="Appbarbtn1_click"/> <shell:ApplicationBar.MenuItems> <shell:applicationbarmenuitem text="appBarMenu1"click="Appbarmenu1_click"/> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:phonea Pplicationpage.resources>
Second, in the CS code in the event function to add the code (here panorama as an example):
#regionPanorama different item displays different ApplicationBarPrivate voidPanoramapage_selectionchanged (Objectsender, SelectionChangedEventArgs e) {Switch((( Panorama) sender). SelectedIndex) { Case 0: ApplicationBar= (ApplicationBar) This. resources["appBar0"]; Break; Case 1: ApplicationBar= (ApplicationBar) This. resources["appBar1"]; Break; }}#endregion