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 !!!