views:

122

answers:

2

Hi I have a silverlight web app, in the default.aspx there is nothing but when I change the silverlight XAML file, and load the main page it launches the silverlight changes into the default.aspx by itself. How does it know to do this? Is it something to do with the html file? I noted the html file has an object tag pointing to the silverlight app, but how does the default.aspx file then link to that html?

+4  A: 

When you create a Silverlight Project with an accompanying web application in the solution, the Visual Studio project template creates several pieces of "scaffolding" for you. It's easiest to explain with a scenario: If I create a project called "Foo" using the Silverlight Application template, I will get the following:

Solution: Foo (2 projects)

Project: Foo

App.xaml

Page.xaml

Project: Foo.Web (Web Application for testing)

Default.aspx - empty

FooTestPage.aspx - this will include an ASP.NET Silverlight Control

FooTestPage.html - this will include a direct reference to the object tags and embed options for the silverlight output.

David in Dakota
Thanks, I realise now why the default.aspx is empty, because its the other aspx that holds the object embedded! Thanks again.
+1  A: 

The default.aspx and html file are just samples created for you. You can delete both and add the silverlight application into any other page if you prefer. Simply use the code in the default.aspx or html file as a guide on how to do this.

Everytime you compile the Silverlight app it copies the xap file into the Clientbin folder in the web application. You can edit these associations by going to the web applications properties and choosing the Silverlight Applications Option.

geoff