Learn Windows Phone 7 together to develop (one. Application Bar)

Source: Internet
Author: User

For Windows Phone 7 programs, the UI is developed with Sliverlight, but it's not exactly the complete collection of sliverlight, the relationship to subsets, because there are no APIs or functional PCs on phone 7 (such as this application BAR), the sliverlight on the PC, let alone.

Application Bar is the so-called menu bar, which includes two types of Iconbutton and menu. The Iconbutton is the same as the toolbar in the menu bar, with the icon; menu is menus, but no level two menu. Be sure to add Microsoft.Phone.shell to the reference before you create it, and add xmlns:shell= "Clr-namespace:microsoft.phone.shell" to the XAML page; Assembly=microsoft.phone.shell ".

I. Iconbar

To create a iconbar, you must have icon,phone7 to the icon's strict requirements: the size must be 48x48-phase of the PNG map, the center of the figure, the foreground is generally white, The size is 26x26. With a picture can be created, if it does not matter, Microsoft has provided a set of icons http://www.microsoft.com/downloads/details.aspx?familyid= 369b20f7-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>

This creates a iconbar. But it is important to note that the number of Iconbar is limited, can only add 5, and the 5th is not shown, that is, in fact, only the maximum of 4.

Two. Menu

Creating a menu is simple and there is no limit.

<navigation:phoneapplicationpage.applicationbar>
<shell:applicationbar IsVisible= "True" is Menuenabled= "True" >>
<shell:applicationbar.menuitems>
<shell:applicat                  Ionbarmenuitem 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= "mTest 2_click "></shell:applicationbarmenuitem>
<shell:applicationbarmenuitem x:Name=" MTest3 "T ext= "Text" click= "Mtest3_click" ></SHELL:APPLICATIONBARMENUITEM>
</shell:applicationbar.menuitems
</shell:applicationbar>
</navigation:phoneapplicationpage.applicationbar>

In addition, it is said to add code directly in the program can also generate ApplicationBar, but I did not succeed. There is also the current applicationbar is not very stable, sometimes in response to the function of the code, will cause 2214 errors! I hope Microsoft's official SDK can be improved after it comes out.

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.