问题描述
当前行为
直接在HTML页面中嵌入和加载Silverlight.xap时,它可以正常工作.但是,当我们在组件内移动相同的代码时,它将不会加载Silverlight.两种情况下的DOM(即通过HTML和组件进行嵌入和加载)都没有任何区别.
Current behavior
When embedding and loading Silverlight.xap directly inside an HTML page, it works fine. But when we move same code inside a component, it won't load the Silverlight. DOM in both cases, i.e. embedding and loading through HTML and through component, doesn't show any difference.
Silverlight-app.Component.HTML页面的代码
当我们直接加载此页面(即localhost/OurApp/Silverlight-app.Component.HTML)时,silverlight内容将被加载并且可以正常工作.但是,当我们在浏览器中打开index.html时(它是我们angular2的主要组件,而Silverlight-app.Component.HTML页面是index.html的子组件),它不会加载silverlight内容.
Code of Silverlight-app.Component.HTML Page
When we load this page directly, i.e. localhost/OurApp/Silverlight-app.Component.HTML, silverlight content gets loaded and it works fine. But when we open index.html in browser (which is main component of our angular2 and Silverlight-app.Component.HTML page is child component of index.html), it don't load silverlight content.
<section>
<div>
<object id="silverlightControlHost" data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="100%" style="min-height: 100%; height: 1000px">
<param name="source" value="clientbin/SilverlightApp.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.61118.0" />
<param name="autoUpgrade" value="true" />
<param name="Windowless" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration: none">
<img src="images/slmedallion.png" alt="Get Microsoft Silverlight" style="border-style: none" />
</a>
</object>
<iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;
border: 0px"></iframe>
<iframe id="desktop" style="visibility: hidden; height: 0px; width: 0px; border: 0px"></iframe>
</div>
</section>
预期/期望的行为
不论通过HTML或通过组件加载,嵌入和加载Silverlight组件都应具有相同的行为.
Expected/desired behavior
Embedding and loading Silverlight component should have same behavior irrespective of loading through HTML or through component.
改变行为的动机/用例是什么?
我们正在将Silverlight应用程序迁移到Angular2.由于完整的迁移将需要几个月的时间,因此我们还将保留一些Silverlight模块.
What is the motivation / use case for changing the behavior?
We are migrating our Silverlight application to Angular2. As complete migration will take months, we are keeping some of the silverlight modules as well.
可更好地理解问题的图像
推荐答案
此示例完全满足您的需求:)
this example does exactly what you need :)
https://github.com/lohiarahul/Angular2-Silverlight-Starter
这篇关于当嵌入组件中时,无法在angular2中加载Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!