Getting Started With Silverlight

In this article I will show how to work with "Silverlight".

Technology used: Visual Studio 2012.

Use the following procedure to start working with Silverlight.

Step 1:

  • Create a Silverlight application named "MySilverlightApplication".

    Create a Silverlight application

    Note: In this case I don't have Silverlight Developer Runtime on my machine, so I need to download it.

    download

    After downloading it, just run it.

    run it

    Now again create the Silverlight application named "MySilverlightApplication".

    Note: if the "MySilverlightApplication" folder already exists then kindly delete it.

    MySilverlightApplication folder
     
  • By the click on the checkbox, your Silverlight application will be automatically attached to the selected "web project" or "website".

    web project

Step 2:

  • Add the button to the "mainpage.xaml" of the Silverlight application and create an "onclick" event of the button.

    onclick event

  • Write the code in "mainpage.xaml.cs" to show an alert message on the click event of a button.

    MessageBox.Show("Hello World");

    alert message on the click event

Step 3:

  • Set the Web project as the start project.

    Web project as start project

  • Run both the pages one by one.

    page

MySilverlightApplicationTestPage.aspx: Click on the button and see the output.

output

MySilverlightApplicationTestPage.html: Click on the button and see the output.

see the output 

Up Next
    Ebook Download
    View all
    Learn
    View all