WP program development-Hello World

Source: Internet
Author: User

1. Create a project

Select "new"-"project" to open the new project dialog box.

Visual C # language-Silverlight for Windows Phone-Windows Phone application

Select Target Platform

Generate a project

2. Layout

The generated project interface has two textblock controls, which are roughly equivalent to the lable control in winform. The text attribute of this control can be modified to display the text.

3. Add button

The process is similar to the Drag Control in winform. However, if you want to modify the text displayed by the button, it is not text but a property called content. Why? This is because it is a rule of Silverlight, I don't know why!

By the way, the control name is in the upper right corner. This is a little different from winform.

4. Double-click the button control to add the Event code:

Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. net;
Using system. windows;
Using system. Windows. controls;
Using system. Windows. documents;
Using system. Windows. input;
Using system. Windows. Media;
Using system. Windows. Media. animation;
Using system. Windows. shapes;
Using Microsoft. Phone. controls;

Namespace hello_world
{
Public partial class mainpage: phoneapplicationpage
{
// Constructor
Public mainpage ()
{
Initializecomponent ();
}

Private void button#click (Object sender, routedeventargs E)
{
// Add Event code
This. pagetitle. Text = "Hello world! "; // One Of The textblock controls generated by the project
}
}
}

5. Effect

Is it easy !!!

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.