In windows phone 8, its very easy to add an App Bar and manage it, but now i test new windows phone 8.1 SDK to build a project with new Geofencing feature but i don\'t know how
Create Class with Method
public static void AddNewAppBarinPage(Page myPage)
{
CommandBar cbar = new CommandBar { ClosedDisplayMode = AppBarClosedDisplayMode.Minimal };
AppBarButton appBarButton = new AppBarButton { Label = "Audio" };
cbar.PrimaryCommands.Add(appBarButton);
myPage.BottomAppBar = cbar;
}
use in Page:
AppBarCustom.AddNewAppBarinPage(this);
In Windows Phone 8.1, We can use BottomAppBar
to add App Bar. Usually we use CommandBar
to create basic BottomAppBar. CommandBar contains two collection: PrimaryCommands
and SecondaryCommands
, It's similar with shell:ApplicationBar.Buttons
and shell:ApplicationBar.MenuItems
in Windows Phone 8.
Read this demo please, we create a CommandBar with two buttons: ZoomOut and ZoomIn, and two menuItem:Test01 and Test02 :
<Page.BottomAppBar>
<CommandBar IsSticky="True" x:Name="appBar">
<CommandBar.PrimaryCommands>
<AppBarButton Icon="ZoomOut" IsCompact="False" Label="ZoomOut"/>
<AppBarButton Icon="ZoomIn" IsCompact="False" Label="ZoomIn"/>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Label="Test01"/>
<AppBarButton Label="Test02"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
Edit: Now the code is correct!
Here's another way. Scroll all the way to the top of the XAML afterwards, click on the first text/string <phone:PhoneApplicationPage
you can either press F4 in order to bring up the "Common" selection or you can just click on it and just go to properties and press "Common" and there you will see a new option called "ApplicationBar". This way is much better, you can create a new fresh one this way.