Study Windows Phone 7 development together (1. Application bar)

Source: Internet
Author: User

For Windows Phone 7ProgramFor example, the UI is developed using sliverlight, but it is not completely the complete set of sliverlight. It is related to the subset, because there are no APIs or functions on the PC (such as the application bar) On Phone 7, sliverlight on the PC should not be mentioned.

Application bar is the so-called menu bar, which includes two types: iconbutton and menu. Iconbutton is equivalent to the toolbar in the menu bar, which can contain icons; menu is the menu, but there is no Level-2 menu. Before creation, you must add Microsoft. phone. and add xmlns: shell = "CLR-namespace: Microsoft. phone. shell; Assembly = Microsoft. phone. shell ".

I. iconbar

To create an iconbar, you must have an icon. phone7 has strict requirements on the icon. The size must be a PNG Image of 48x48 Prime. The image type is centered. The foreground color is generally white and the size is 26x26. with the picture can be created, if there is no relationship, Microsoft provides a set of icon http://www.microsoft.com/downloads/details.aspx? Familyid = 492b20f7-9d30-4cff-8a1b-f80901b2da93 & displaylang = en.

Create iconbar:

<Navigation: phoneapplicationpage. ApplicationBar>
<Shell: ApplicationBar isvisible = "true" ismenuenabled = "true">
<Shell: ApplicationBar. Buttons>
<Shell: applicationbariconbutton X: Name = "btntest" Click = "btntest_click" iconuri = "appbar.add.rest.png"> </shell: applicationbariconbutton>
</Shell: ApplicationBar. Buttons>
</Shell: ApplicationBar>
</Navigation: phoneapplicationpage. ApplicationBar>

In this way, an iconbar is created. However, you must note that there are limits on the number of iconbars. You can add up to five iconbar entries, and 5th iconbar entries cannot be displayed. That is, you can only add up to four iconbar entries.

 

Ii. Menu

Creating a menu is simple and has no restrictions.

<Navigation: phoneapplicationpage. ApplicationBar>
<Shell: ApplicationBar isvisible = "true" ismenuenabled = "true">
<Shell: ApplicationBar. menuitems>
<Shell: applicationbarmenuitem X: Name = "mtest" text = "text" Click = "mtest_click"> </shell: applicationbarmenuitem>
<Shell: applicationbarmenuitem X: Name = "mtes1" text = "text" Click = "mtest1_click"> </shell: applicationbarmenuitem>
<Shell: applicationbarmenuitem X: Name = "mtest2" text = "text" Click = "mtest2_click"> </shell: applicationbarmenuitem>
<Shell: applicationbarmenuitem X: Name = "mtest3" text = "text" Click = "mtest3_click"> </shell: applicationbarmenuitem>

</Shell: ApplicationBar. menuitems>
</Shell: ApplicationBar>
</Navigation: phoneapplicationpage. ApplicationBar>

In addition, it is said thatCodeYou can also generate ApplicationBar, but I have not succeeded. In addition, the current ApplicationBar is not very stable. Sometimes, after writing code in the response function, it will cause a 2214 error! We hope that the official SDK of Microsoft can be improved.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.