Silverlight (1. Install and create a project)

Source: Internet
Author: User

1. Download and install Silverlight: Microsoft Silverlight 3 tools (upgrade vs2008 to SP1 before installation)

2. Like most people, myProgramFinally, after I installed it, I got OK, and there was no error in running the vs2008 project. I sorted out my own installation sequence: vs2008 (later vs2010 was installed ), framework3.5-SP1, VS2008-SP1, silverlight3,silverlight_cmd.exe.

3. Create a project and create a Silverlight Navigation Application

Find the home. XAML file F5 in views for debugging and running.

Add the Silverlight control: button and textbox.

Double-click button writingCode

Home. XAML Page code:

Code

< Navigation: page X: Class = " Silverlightapplication3.home " Xmlns = " Http://schemas.microsoft.com/winfx/2006/xaml/presentation " Xmlns: x = " Http://schemas.microsoft.com/winfx/2006/xaml " Xmlns: d = " Http://schemas.microsoft.com/expression/blend/2008 " Xmlns: MC = " Http://schemas.openxmlformats.org/markup-compatibility/2006 " Xmlns: navigation = " CLR-namespace: system. Windows. controls; Assembly = system. Windows. Controls. Navigation " MC: ignorable = " D " D: designwidth = " 640 " D: designheight = " 480 " Title = " Home Page " Style = " {Staticresource pagestyle} " Xmlns: datainput = " CLR-namespace: system. Windows. controls; Assembly = system. Windows. Controls. Data. Input " >

grid X: name = " layoutroot " >
scrollviewer X: Name = " pagescrollviewer " style = " {staticresource pagescrollviewerstyle} " >

<Stackpanel X: Name="Contentstackpanel">

< Textblock X: Name = " Headertext " Style = " {Staticresource headertextstyle} " Text = " Home Page " />
< Button content = " Click me " Height = " 42 " Name = " Button1 " Width = " 119 " Click = " Button#click " Fontsize = " 16 " Fontweight = " Bold "   />
< Textblock X: Name = " Contenttext " Style = " {Staticresource contenttextstyle} " Text = " Homepage content " />
< Textbox height = " 23 " Name = " Textbox1 " Width = " 120 "   />
</ Stackpanel >

</Scrollviewer>
</Grid>

</Navigation: Page>

 

Home. XAML. CS

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. Navigation;
Using System. Windows. shapes;

namespace silverlightapplication3
{< br> Public partial class Home: page
{< br> Public Home ()
{< br> initializecomponent ();
}

//Run the command when you navigate to this page.
Protected Override VoidOnnavigatedto (navigationeventargs E)
{
}

Private   Void Button#click ( Object Sender, routedeventargs E)
{
Headertext. Text =   " My first Silverlight application! " ;
Textbox1.text = Datetime. Now. tostring ();
}
}
}

 

 

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.