views:

143

answers:

1

I want to make a Silverlight application in Expression Blend because of the rich UI and navigation of Blend. But I want to store the Silverlight application in an ASP.NET MVC web project. When I try to make a new Silverlight application, the default web application is an ASP.NET Web application (or web site, if I'm wrong). Can I make a single Silverlight application (no web project) then import in an ASP.NET MVC application? How can I do this?

+2  A: 

Yes, you can.

  1. Create your Silverlight application without the web project.
  2. Add asp.net mvc project to the current solution.
  3. Go to the properties of you asp.net mvc project
  4. Select the Silverlight Application tab, click the Add button, and select the Silverlight project in the solution. Also specifiy the destination folder (in the asp.net mvc) where you want to place xap file.
  5. Create the view for you silverlight application.
  6. Reference your silvelight applicatition in the view. For example:

Code:

<object type="application/x-silverlight-2"  
    data="data:application/x-silverlight,"    
    width="100%" height="100%">  
    <param name="source" value="/ClientBin/MySlApp.xap"/>  
    <param name="onError" value="onSilverlightError" />
</object> 

That's it...

Cheers

rrejc