第一步:下载组件Download Silverlight Tools 1.0.2解压缩,将dll文件放到合适的位置。
第二步:在工具栏右键 [Choose Items] 用[Browse]找到Divelements.SilverlightTools.dll,添加
第三步:将组件拖到silverlight编辑页面中,这时自动添加了对命名空间的引用
xmlns:divtools="clr-namespace:Divelements.SilverlightTools;assembly=Divelements.SilverlightTools" @H_502_18@@H_197_2@ @H_197_2@
第四步:在要嵌入的位置加入HtmlHost组件,例如:
<divtools:HtmlHost Name="htmlHost" sourceUri="http://localhost:2883/enbedded.aspx" /> @H_502_18@
第五步:最后不要忘了在silverlight 的宿主页,加上 <param name="Windowless" value ="true" />,否则会弹出窗口报错“You must be using the Silverlight plugin in windowless mode to use this control.”,事例如下:
//以下来自silverlight自动生成的TestPage.aspx
<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/ECSDashboard.xap"/> …… <param name="autoUpgrade" value="true" /> <param name="Windowless" value ="true" /> </object> <div> </form> </body> @H_502_18@
----------------------------------------------直接加入Html内容,实例
private void Button_Click(object sender,RoutedEventArgs E) { // Populate the control with html @R_450_10495@ngBuilder html = new StringBuilder(); html.AppendLine("<h1>heading</h1>"); html.AppendLine("<p>This is a paragraph <span style='color: red'> using</span> CSS <strong>formatTing</strong>.</p>"); html.AppendLine("<ul><li>List Item 1</li><li>List Item 2</li></ul>"); htmlHost.sourceHtml = html.To@R_450_10495@ng(); }@H_502_18@
@H_197_2@
@H_197_2@@H_197_2@
大佬总结
以上是大佬教程为你收集整理的在Silverlight里面嵌入HTML/ASPX/URL/Document/SVG等全部内容,希望文章能够帮你解决在Silverlight里面嵌入HTML/ASPX/URL/Document/SVG等所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
猜你在找的silverlight相关文章
- silverlight – 如何在Windows Phone 7中创建连续动画? 2022-05-04
- wpf – 嵌入图像在UserControl中不显示 2022-05-03
- WPF的Deepzoom 2022-05-03
- silverlight – 设置ComboBoxItem的文本和值 2022-05-03
- wpf – 寻找股票图表组件 2022-05-03
- 如何在Silverlight中以编程方式转到特定的URL? 2022-05-03
- Silverlight Webservice“远程服务器返回错误:NotFound” 2022-05-03
- osx – 无法输入Silverlight 5输入字段(Chrome)MacOS 2022-05-03
- 客户端WCF DataContract具有来自服务的空/空值 2022-05-03
- 使用MVVM Light Messenger与Silverlight 4 ChildWindow对话框类 2022-05-03