Sign In
Posted By: Ivana Tilca | Mar 11th @ 9:39 AM
 silverlight

First of all let's go to New --> Project…, select Visual C# --> Silverlight, select ‘Silverlight Application.

1. The following dialog will appear. To run a Silverlight Application, it needs to be hosted in an html web page. In this area u can choose how do u want to host this app.

image

The options are:

  • Add a new web to the solution for hosting the control (the most appropriate. You can then choose the type of web project – a Web Site or a Web Application Project.)
  • Generate an HTML test page to host Sl within this project.(it doesn’t provide access to the full design environment Visual Studio can offer for a web project )
  • Link this Silverlight control into an existing web site. (disabled because you’ve just created a new solution)

     Click Ok

Visual Studio creates this web pages:

  • Default.aspx (main page of your web application, the silv content is not in here)
  • ProjectNameTestPage.aspx (default page for debugging)

we will not need Default.aspx so we can close this one. Now let's open ProjectNameTestPage.aspx. For those who have worked with Silverlight 1.0 can find a bit different the fact that we don't call javascript Silverlight.js that's because <asp:Silverlight> is the control that now loads the silverligth app. (calling js files also works)

<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
TagPrefix="asp" %>

Check out that in Source property calles "~/ClientBin/FirstSilverlightProject.xap". Build the project in order to create this xap (just a ZIP file). Inside this zip file u can see there are 4 dll files and a appmanifest.xaml. (pic below)

image image

Let's add an bmp(bitmap) to our site. Add --> Existing Item. (Be sure to add this to the Silverlight project, and not the associated web project.) Visual Studio will set the Build Action to Content, the item will be added to the .xap file.

image

Let's now add content to the Page.xaml file so we can try our site. Publish it and there u have u new Silverlight 2.0 first test app.

 

Rating:
0
0
Be the first to comment!