简体   繁体   中英

Open Windows Phone ApplicationBar from code-behind

Is there an official way or trick to open the Windows Phone ApplicationBar using C# from the code-behind? I'd like to show my users additional options hidden in the menu.

To be clear, I don't need to create the menu in code-behind (but can, if that helps in any way).

There are no way to open application bar programmatically. But you can create application bar in C#. Here is the sample.

ApplicationBar = new ApplicationBar();
    ApplicationBar.Mode = ApplicationBarMode.Default;
    ApplicationBar.Opacity = 1.0; 
    ApplicationBar.IsVisible = true;
    ApplicationBar.IsMenuEnabled = true;

    ApplicationBarIconButton button1 = new ApplicationBarIconButton();
    button1.IconUri = new Uri("/Images/YourImage.png", UriKind.Relative);
    button1.Text = "button 1";
    ApplicationBar.Buttons.Add(button1);

    ApplicationBarMenuItem menuItem1 = new ApplicationBarMenuItem();
    menuItem1.Text = "menu item 1";
    ApplicationBar.MenuItems.Add(menuItem1);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM