1.MainPage.xaml

 <UserControl x:Class="SilverlightClient.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="" d:DesignHeight="">
<Grid x:Name="LayoutRoot">
<StackPanel>
<!--导航栏-->
<StackPanel Orientation="Horizontal" Background="WhiteSmoke">
<Button x:Name="myHTML" Content="HTML内容" FontSize=""/>
<Button x:Name="myFlash" Content="Flash" FontSize=""/>
<Button x:Name="myPDF" Content="PDF文档" FontSize=""/>
</StackPanel>
<Grid x:Name="Container"/>
</StackPanel>
</Grid>
</UserControl>

2.MainPage.xaml.cs

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Divelements.SilverlightTools; namespace SilverlightClient
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
//注册事件触发处理
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
this.myHTML.Click += new RoutedEventHandler(myHTML_Click);
this.myFlash.Click += new RoutedEventHandler(myFlash_Click);
this.myPDF.Click += new RoutedEventHandler(myPDF_Click);
} void MainPage_Loaded(object sender, RoutedEventArgs e)
{
GetRichContent("http://cn.bing.com", UriKind.Absolute);
} void myPDF_Click(object sender, RoutedEventArgs e)
{
GetRichContent("/test.pdf",UriKind.Relative);
} void myFlash_Click(object sender, RoutedEventArgs e)
{
GetRichContent("/clock.swf", UriKind.Relative);
} void myHTML_Click(object sender, RoutedEventArgs e)
{
GetRichContent("http://cn.bing.com", UriKind.Absolute);
} //获取Rich Content
void GetRichContent(string uri,UriKind uk)
{
Container.Children.Clear();
ControlHtmlHost chtml = new ControlHtmlHost();
HtmlHost hh = chtml.FindName("htmlHost") as HtmlHost;
hh.SourceUri = new Uri(uri, uk);
Container.Children.Add(chtml);
}
}
}

3.添加Divelements.SilverlightTools.dll文件

4.在服务端添加相应的访问文件

Silverlight中嵌套html、swf、pdf的更多相关文章

  1. WPF/Silverlight中的RichTextBox总结

    WPF/Silverlight中的RichTextBox总结   在WPF或者是在Silverlight中有个非常强大的可以编辑的容器控件RichTextBox,有的时间会采取该控件来作为编辑控件.鉴 ...

  2. jsp的 javascript中 嵌套 html 注释

    看到公司的代码,我也是蛋疼了,各种乱. 还发现有很多的jsp的 javascript中 嵌套 html 注释, 这个可行? 我之前可是没用过. 后面查找各种资料发现,这个也是可行的,主要是为了兼容不支 ...

  3. bootstarp-table表格中嵌套多个BUTON按钮实现

    bootstarp-table表格中嵌套多个BUTON按钮实现   有时我们需要在bootsharp-table表格中嵌套多个按钮,来实现不同的功能,大概界面如下:   实现功能如下: 1:构建表格 ...

  4. Silverlight中文本框添加回车事件后,换行无法清除的解决方法

    在开发Silverlight的项目中,为了更好的用户体验,我们常要给一些控件添加一些快捷键.然而,在Silverlight中当用户回车提交后,光标停留在文本框的第二行怎么也清除不掉,经过一段时间研究, ...

  5. scrollview 中嵌套多个listview的最好解决办法

    在scrollview中嵌套多个listview的显示问题. 只需要调用如下的方法传入listview和adapter数据即可. /** * 动态设置ListView组建的高度 */ public s ...

  6. SharePoint 2013 Silverlight中使用Net客户端对象模型

    1.创建Silverlight时,选择Silverlight 4,不要选择版本5,试了很久版本5都调用不了,自己也不知道什么原因,谷歌也没找到答案,后来尝试版本4,可以调用: 至于Host the S ...

  7. ScrollView中嵌套ListView显示

    想要ScrollView中嵌套显示ListView 需要自定义ListView 并重写onMeasure方法 重新计算  heightMeasureSpec的高度 int newHeight = Me ...

  8. Silverlight中的TabControl如何绑定数据?重写tabcontrol和tabItem 解决绑定友好问题。可以绑定对象集合

    在 WPF 中,TabControl 可以直接将 ItemsSource 绑定数据源,见 将 TabControl 绑定到数据的示例 http://msdn.microsoft.com/zh-cn/l ...

  9. 在Repeater中嵌套使用Repeater

    在一般的网站中浏览类别的用户控件通常都位于大多数 ASP.NET 页的左边,它使用户能够按类别快速的查找产品.最近遇到一个客户,因为在他网站上展示的产品并不多,所以要求在原有类别浏览的基础上将产品也加 ...

随机推荐

  1. LeetCode41 First Missing Positive

    题目: Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2 ...

  2. LeetCode30 Substring with Concatenation of All Words

    题目: You are given a string, s, and a list of words, words, that are all of the same length. Find all ...

  3. C#分屏控件用法实例

    本文实例中的自定义类PictureBox继承于UserControl,最终实现简单的分屏功能.分享给大家供大家参考之用.具体实现代码如下: public partial class PictureCo ...

  4. nodejs的mysql模块学习(七)连接池事件

    连接池事件 connection 当建立连接的时候就会触发 pool.on('connection' function(connection){ connection.query('SET SESSI ...

  5. MySQL(22):事务管理之 事务回滚

    1. 在操作事务的时候,如果发现当前事务操作是不合理的,此时只要还没有提交事务,就可以通过回滚取消当前事务,接下来就针对事务的回滚进行详细讲解. 2. 为了演示回滚操作,在上一个笔记案例基础之上,此时 ...

  6. Oracle安装步骤及PL/SQL Developer连接数据库

    一:Oracle安装步骤及PL/SQL Developer连接数据库 win7 64位 11g 点击(操作步骤):http://www.cnblogs.com/haoke/articles/27343 ...

  7. JS中String类型转换Date类型 并 计算时间差

    JS中String类型转换Date类型 1.比较常用的方法,但繁琐,参考如下:主要使用Date的构造方法:Date(int year , int month , int day)<script& ...

  8. java.util.concurrent.CountDownLatch

    闭锁是一种同步工具类,可以延迟线程的进度直到闭锁到达终止状态. 闭锁的作用相当于一扇门,在闭锁到达结束状态之前,这扇门一直是关闭的,任何线程都不能通过这扇门,当闭锁到达结束状态时,这扇门会打开并允许所 ...

  9. (ASP.Net)MVC4怎么设置@Html.TextBoxFor样式

    添加自定义样式和属性: @Html.TextBoxFor(s=>s.dd,new {@class="main",@style="width: 100px;" ...

  10. codeforces 613B B. Skills(枚举+二分+贪心)

    题目链接: B. Skills time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...