user3911053
user3911053

Reputation:

Windows Phone 8 AppBar Command

I am trying to get in my AppBar the style of command that you see in about below:

enter image description here

I can get buttons (like add and settings) to show up fine, but I can't find any way to show commands like about. Is this not supposed to be done in the AppBar?

Upvotes: 1

Views: 169

Answers (1)

Aleksandar Toplek
Aleksandar Toplek

Reputation: 2821

Silverlight

Take a look at Menu Items in documentation

Sample from documentation:

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

WinRT

Use CommandBar where PrimaryCommands show up like add/settings and SecondaryCommands like menu item about. Take a look at this article explaining the differences.

<page.BottomAppBar>
    <commandBar>
        <commandBar.PrimaryCommands>
            <appBarButton Label="{Binding AppBarLabel}" Command="{Binding SomeCommand}">
                <appBarButton.Icon>
                    <pathIcon HorizontalAlignment="Center" VerticalAlignment="Center" Data="Some path"/>
                </appBarButton.Icon>
            </appBarButton>
        </commandBar.PrimaryCommands>
        <commandBar.SecondaryCommands>
            <appBarButton x:Uid="AppBarSec" Label="$$get from resource$$" Command="{Binding SomeCommand}">
            </appBarButton>
        </commandBar.SecondaryCommands>
    </commandBar>
</page.BottomAppBar>

Upvotes: 3

Related Questions