Home > DeveloperSection > Articles > Silverlight application

Silverlight application


SilverLight SilverLight 
Ratings:
0 Comment(s)
 3727  View(s)
Rate this:

Silverlight application

In this tutorial I will tell you, how to create your first Silverlight application with the help of visual studio 2010 IDE.

Prerequisite

Ø  Visual Studio 2010 IDE

Ø  Silverlight 3.0 or 4.0

For creating first Silverlight application follow these steps

Ø  Open visual studio 2010.

Ø  Go to File menu followed by New and click it. After performing this step a new project dialog box is open.

Silverlight application

 

Ø  From installed template select Silverlight and from project template Silverlight application.

Ø  In name box provide your application name such as FirstSilverLightApplicationDemo and choose the location of your application and then click OK button.

Silverlight application

 

Ø  After clicking OK button a new dialog box opens which ask some additional behavior about your application. Don’t change default settings and simply click OK button.

Silverlight application

 

Ø  After clicking OK button a new window is open whose name is MainPage.xaml. You have to perform all the activities on this page.

Every Silverlight application consists of XAML markup code and C# or any .NET language code for implementing behavior.

Write down the following code in XAML window

<Button Content="Silverlight Application Demo" Height="28" HorizontalAlignment="Left" Margin="68,128,0,0" Name="btnDemo" VerticalAlignment="Top" Width="249" />

These code snippets create a Button control. Double click on Button control and code behind file open. Write down following code.

private void btnDemo_Click(object sender, RoutedEventArgs e)

{

            MessageBox.Show("Hello Dear! Welcome to first demonstration of Silverlight Application.");

}

 

For executing application press CTRL+F5.

Output of the following code snippet is as follows

Silverlight application

 

When user click the button object then a dialog box opens which shows some message to user.

Silverlight application


Don't want to miss updates? Please click the below button!

Follow MindStick