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 to add an App Bar in the App.
3 Answers
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!

- 712
- 7
- 25

- 8,231
- 3
- 39
- 37
-
1`IsSticky` doesn't do anything on WP 8.1 – mcont Nov 09 '14 at 13:06
-
Is it possible to be placed on top of the app? (TopAppBar lets say) – Vassilis Apr 28 '16 at 10:17
-
We can't do that. In windows phone, there is BottomAppBar only. – Chris Shao Apr 29 '16 at 01:55
-
Check out this link to add an app bar using XAML -> https://msdn.microsoft.com/en-us/library/windows/apps/hh394040(v=vs.105).aspx – Curiosity May 28 '17 at 14:17
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.
-
It is also a good way if i can choose two answers as correct i will do thank you :) – May 08 '14 at 12:19
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);

- 27,212
- 44
- 82
- 159

- 11
- 1