问题描述
我决定WPFs转换为Silverlight应用程序。我唯一的问题是试图得到它的显示在我的MVC Web浏览器Silverlight应用程序。我添加了所有我的Silverlight项目到我的MVC项目。我只是没有得到它显示我的Silverlight应用程序。谁能告诉我什么,我在我的CSHTML做错了我的ASP部分
I decided to convert the WPFs into a Silverlight applications. My only problem is trying to get it to display the silverlight application in my MVC web browser. I added all of my silverlight projects into my MVC project. I am just not getting it to show my silverlight application. Can someone tell me what I am doing wrong in my asp part in my CSHTML
<h2>System</h2>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="1000" height="800">
<param name="source" value="/ClientBin/System.xap" />
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.61118.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.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>
</asp:Content>
我甚至试图摆脱我增加了项目的根文件夹的完整源路径。
I even tried to get the full source path from the root folder of the project I added.
<param name="source" value="/System/System.Web/ClientBin/System.xap" />
它仍然不会显示Silverlight应用程序。
It still won't display the silverlight application.
我注意到的另一件事是=服务器中,RUNAT有一个绿色的下划线,并说:
The other thing I notice is runat="server", the runat has a green underline and says:
ASP.NET属性只允许在ASP.NET文件。
我不知道这是否是假设这样做或没有。
I don't know if it is suppose to do that or not.
推荐答案
你有Silverlight项目添加到您的MVC项目?如果你没有,你需要去你的项目,是你的MVC,右键单击它并转到属性。转到Silverlight应用程序然后添加项目也有。然后与您当前code尝试在的地方,看看有没有什么工作的。
Do you have the Silverlight project added to your MVC project? If you don't you will need to go to your project that is your MVC, right click it and go to properties. Go to silverlight applications then add the project there too. Then try it with your current code in place and see if that works.
这篇关于嵌入一个Silverlight应用程序到一个MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!