i have an asp.net-mvc website and i want to merge in some functionality from a silverlight app. i could rewrite 开发者_运维问答but for the time being i wanted to see if there is any clean way to "include" a few silverlight pages inside my mvc app.
what is the recommended way of doing this ?
The New Silverlight Application Wizard allows you to choose ASP.NET MVC as host application and it will setup the necessary parts:
All that you need is to embed the Silverlight application in any view:
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/SomeSlApp.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
You could also write a HTML helper allowing you to achieve this in a cleaner way.
精彩评论