ApplicationBarMenuItem Class
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
An item that can be added to the menu of an ApplicationBar.
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
XMLNS for XAML: Not mapped to an xmlns.
The ApplicationBarMenuItem type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ApplicationBarMenuItem() | Creates a new instance of the ApplicationBarMenuItem class. |
![]() | ApplicationBarMenuItem(String) | Creates a new instance of the ApplicationBarMenuItem class that displays the specified string. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
In addition to the icon buttons, you can add one or more text-based menu items. These items are displayed in a list that slides up from underneath the icon buttons when the user clicks the ellipsis. The menu items are used for application actions that are less frequently used, or for actions that are difficult to convey with only an icon. For more information, see App bar for Windows Phone.
The following example creates an Application Bar in XAML that has two icon buttons and two menu items. For the full example, see How to create an app bar using XAML for Windows Phone.
<phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar Mode="Default" Opacity="1.0" IsMenuEnabled="True" IsVisible="True"> <shell:ApplicationBarIconButton Click="Save_Click" IconUri="/Images/save.png" Text="save" /> <shell:ApplicationBarIconButton Click="Settings_Click" IconUri="/Images/settings.png" Text="settings" /> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Click="MenuItem1_Click" Text="menu item 1" /> <shell:ApplicationBarMenuItem Click="MenuItem2_Click" Text="menu item 2" /> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar>
The following example creates an Application Bar in code that has one icon button and one menu item. For the full example, see How to create an app bar using code for Windows Phone.
The following example creates an Application Bar that can be reused on multiple pages in your application. For the full example, see How to reuse an app bar on multiple pages for Windows Phone.
<Application.Resources> <shell:ApplicationBar x:Key="GlobalAppBar" IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1" Click="Button1_Click" /> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2" Click="Button2_Click" /> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="MenuItem 1" Click="MenuItem1_Click" /> <shell:ApplicationBarMenuItem Text="MenuItem 2" Click="MenuItem2_Click" /> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </Application.Resources>
The following example creates two Application Bars that can be used in a single pivot control in your application. For the full example, see How to use different app bars in a single Pivot control for Windows Phone.
<Application.Resources> <shell:ApplicationBar x:Key="AppBar1" IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1" Click="Button1_Click" /> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="MenuItem 1" Click="MenuItem1_Click" /> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> <shell:ApplicationBar x:Key="AppBar2" IsVisible="True" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1" Click="Button1_Click" /> <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2" Click="Button2_Click" /> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem Text="MenuItem 1" Click="MenuItem1_Click" /> <shell:ApplicationBarMenuItem Text="MenuItem 2" Click="MenuItem2_Click" /> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </Application.Resources>



