简体   繁体   中英

how to add more than 4 icons to the application bar og windows phone 7 application development

I am building my first app in windows phone 7 application. I need to add 5 application bar icons in my app. So I wrote some custom code in the .xaml.cs file which goes like this.

namespace AAPApplication
{

  public partial class AAP : PhoneApplicationPage
  {
     public AAP()
     {
        InitializeComponent();
        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/icon_home_deselect.png", UriKind.Relative);
        button1.Text = "Home";
        ApplicationBar.Buttons.Add(button1);

        ApplicationBarIconButton button2 = new ApplicationBarIconButton();
        button2.IconUri = new Uri("/Images/icon_event_deselect.png", UriKind.Relative);
        button2.Text = "Event";
        ApplicationBar.Buttons.Add(button2);

        ApplicationBarIconButton button3 = new ApplicationBarIconButton();
        button3.IconUri = new Uri("/Images/icon_share_deselect.png", UriKind.Relative);
        button3.Text = "Share";
        ApplicationBar.Buttons.Add(button3);

        ApplicationBarIconButton button4 = new ApplicationBarIconButton();
        button4.IconUri = new Uri("/Images/icon_news_deselect.png", UriKind.Relative);
        button4.Text = "News";
        ApplicationBar.Buttons.Add(button4);

        ApplicationBarIconButton button5 = new ApplicationBarIconButton();
        button5.IconUri = new Uri("/Images/icon_video_deselect.png", UriKind.Relative);
        button5.Text = "Video";
        ApplicationBar.Buttons.Add(button5);
    }

Although i am building a custom app bar still i am not able to add the 5th icon. Rest is working fine. Can anyone give me the way to add the 5th icon

It is not possible. The application bar has been designed to host 1 to 4 icons in order to create a consistent UI across apps. Further operations should be hidden, but revealed when the users taps the ellipsis in the right-hand corner.

If you really want to do this, you will have to create your own app bar (although I would not recommend it!)/

It is not possible to have more than 4 icons in your app bar. So what you can do is that you can take more than 4 buttons in your application bar position. Thus that should solve your problem as you can put buttons easily and also write code in their click event to navigate to another page

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