利用C1HtmlHost嵌套页面,并且在html页面中弹出该窗口出错?
在Silverlight中嵌套页面:
- HTML code
<c1ext:C1HtmlHost x:Name="hTml" Width="Auto" Height="Auto" SourceUri="Default.aspx" ></c1ext:C1HtmlHost>
在html页面中利用jscript调用Silverlight中弹出页面的方法
- JScript code
function OnClick_Url(s_url, from_url) { var control = document.getElementById("silverlightControl"); control.content.Page.ShowChildPage("../WebServiceUI/"+s_url); }Silverlight中弹出页面的方法
- C# code
public void ShowChildPage(String StrUri) { Popup myPopup = new Popup(); Frame childFrame = new Frame(); myPopup.Child = childFrame; myPopup.IsOpen = true; ChildPage aChildPage = new ChildPage(myPopup, StrUri); childFrame.Content = aChildPage; myPopup.VerticalOffset = this.ActualHeight / 2 / 2 / 2 / 2 / 2; myPopup.HorizontalOffset = this.ActualWidth / 2 / 2; }错误的地方:在弹出的页面上显示:To use this control the Silverlight plugin must have its 'windowless' parameter set to true.
请问这个问题怎样解决?
[解决办法]
c1ext:C1HtmlHost 这个不是标准控件。
参考一下
http://msdn.microsoft.com/en-us/library/bb979728(VS.95).aspx
http://forums.silverlight.net/forums/p/168866/380501.aspx
[解决办法]
这个你在html必须设置 windowless 的值为true;
- HTML code
<body> <form id="form1" runat="server" style="height:100%"> <div id="silverlightControlHost"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> <param name="source" value="ClientBin/TestRichTestEdit.xap"/> <param name="onError" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="3.0.40624.0" /> <param name="autoUpgrade" value="true" /> <param name="windowless" value="true" /> <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" 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> </form></body>