[Getting started with WP7] Hello world, the first Windows Phone application

Source: Internet
Author: User
Tags visual studio 2010

Install the Windows Phone 7 development tool on Windows 2003 and XP

 

1. New Project --- Windows Phone application named helloworld
2. After the project is created, mainpage. XAML is opened by default. This is a Silverlight page. The design view is displayed on the left, and The XAML code is displayed on the right. The mouse selects the code in the design view, and the cursor automatically moves to the corresponding node in the XAML code.
Modify applicationtitle and pagetitle as our custom content. These are two textblock controls.
3. Add a widget and drag it from the leftmost toolbox panel to the design map. Adjust to the desired location. Here we add a button and a textblock text control.
Double-click the button to add the button event to change the textblock text:
Private void button#click (Object sender, routedeventargs E)
{
Textblock1.text = "Hi, my friend! ";
}
4. Click F5 to start emulator for debugging. It takes a long time for the first run to enter the program, and then it will be faster.

A simple Windows Phone demo is complete.

 

 

For example, this is the default project structure of the Windows Phone application created in Visual Studio 2010.

 

(1) properties \ appmanifest. xml
An Application List file required to generate an application package

(2) properties \ assemblyinfo. CS
Metadata containing the name and version will be embedded into the generated assembly

(3) properties \ wmappmanifest. xml
Defines resources and functions from the operating system perspective. For example, iconpath, backgroundimageuri, and title define icons, background images, and application titles respectively. You can edit the XML code or modify the values of these attributes on the "application" tab of the project properties.

<Capabilities> some define the list of functions required by Windows Phone. By default, all functions are included. You can remove unnecessary functions, however, if you try to use a feature that is not included in the function list, you will receive an unauthorizedaccessexception exception. The name in the function list is easy to understand. For example, id_cap_location indicates that you want to access. device. the local (location) service in the location namespace, but some functions are associated with many namespaces and classes.

(4) References folder
Lists of database files (sets) to provide functions and services for application work.
By default, the project contains two Windows Phone-related references:
Microsoft. phone and Microsoft. phone. interOP, windows. phone provides access to Microsoft. phone. controls and Microsoft. phone. if you want to use the sensor, you also need to add Microsoft. devices. sensors reference.

(5) app. XAML and App. XAML. CS
Define the entry point of the application, initialize resources within the application range, and display the application user interface.

(6) mainpage. XAML/mainpage. XAML. CS
In the design view, the program page (with a user interface) in the application is displayed as a preview of the Windows Phone 7 user interface. You can drag and drop the control to the design interface, view the layout preview of Windows Phone 7 in real time. When you develop a Silverlight application in Visual Studio 2010, if you modify the XAML code, your modifications will be reflected on the Windows Phone 7 simulator screen.

(7)applicationicon.png
The app icon in the mobile app list.

(8w.background.png
The application icon on the start page.

(9)splashscreenimage.jpg
When an application is loaded, the simulator and device need to display the startup screen. The startup screen is a 24-bit color-depth, X pixel bitmap file in the project-depth, the startup screen must be a 24-bit color-depth, X pixel JPEG format file. If you use a PNG file instead, the startup screen will not be displayed.

 

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.