Silverlight中嵌套html、swf、pdf
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的更多相关文章
- WPF/Silverlight中的RichTextBox总结
WPF/Silverlight中的RichTextBox总结 在WPF或者是在Silverlight中有个非常强大的可以编辑的容器控件RichTextBox,有的时间会采取该控件来作为编辑控件.鉴 ...
- jsp的 javascript中 嵌套 html 注释
看到公司的代码,我也是蛋疼了,各种乱. 还发现有很多的jsp的 javascript中 嵌套 html 注释, 这个可行? 我之前可是没用过. 后面查找各种资料发现,这个也是可行的,主要是为了兼容不支 ...
- bootstarp-table表格中嵌套多个BUTON按钮实现
bootstarp-table表格中嵌套多个BUTON按钮实现 有时我们需要在bootsharp-table表格中嵌套多个按钮,来实现不同的功能,大概界面如下: 实现功能如下: 1:构建表格 ...
- Silverlight中文本框添加回车事件后,换行无法清除的解决方法
在开发Silverlight的项目中,为了更好的用户体验,我们常要给一些控件添加一些快捷键.然而,在Silverlight中当用户回车提交后,光标停留在文本框的第二行怎么也清除不掉,经过一段时间研究, ...
- scrollview 中嵌套多个listview的最好解决办法
在scrollview中嵌套多个listview的显示问题. 只需要调用如下的方法传入listview和adapter数据即可. /** * 动态设置ListView组建的高度 */ public s ...
- SharePoint 2013 Silverlight中使用Net客户端对象模型
1.创建Silverlight时,选择Silverlight 4,不要选择版本5,试了很久版本5都调用不了,自己也不知道什么原因,谷歌也没找到答案,后来尝试版本4,可以调用: 至于Host the S ...
- ScrollView中嵌套ListView显示
想要ScrollView中嵌套显示ListView 需要自定义ListView 并重写onMeasure方法 重新计算 heightMeasureSpec的高度 int newHeight = Me ...
- Silverlight中的TabControl如何绑定数据?重写tabcontrol和tabItem 解决绑定友好问题。可以绑定对象集合
在 WPF 中,TabControl 可以直接将 ItemsSource 绑定数据源,见 将 TabControl 绑定到数据的示例 http://msdn.microsoft.com/zh-cn/l ...
- 在Repeater中嵌套使用Repeater
在一般的网站中浏览类别的用户控件通常都位于大多数 ASP.NET 页的左边,它使用户能够按类别快速的查找产品.最近遇到一个客户,因为在他网站上展示的产品并不多,所以要求在原有类别浏览的基础上将产品也加 ...
随机推荐
- JS 公共方法
1.Format函数 $.GM.Format = function (source, params) { if (arguments.length == 1) return function () { ...
- 1.4.8 拼凑在一起(putting the pieces together)
putting the pieces together 在最高的级别,schema.xml结构如下, <schema> <types> <fields> <u ...
- 【Linux/Ubuntu学习6】unbuntu 下载android源码
在Windows下安装Cygwin,通过Cygwin也可在Windows里通过本文的下载步骤下载Android源码. 以下为在Ubuntu下下载Google Android4.4源码的步骤: 1. 安 ...
- centos下 rpm包sphinx安装成功提示
sphinx: /etc/sphinx /usr/share/sphinx Sphinx installed! Now create a full-text index, start the sear ...
- Git 对象
Git 提供了很多方法可以方便地访问 Git 库中的对象: ♦ 采用不分的 SHA1 哈希值.不必把 40 位的哈希值写全,只采用开头的部分(4 位以上),只要不与现有的其他哈希值冲突即可. ♦ 使用 ...
- 如何解决firefox下window.event的问题
一.在函数中传递event参数 在函数中传递event参数,这样我们就可以兼容IE和FF的event的获取了,如下面的函数: function _test(evt){ var src = evt ...
- SLR,语法分析表的构建
太累了,感觉不会再爱了.执行了跟编译原理上的一模一样的例子,输出了正确结果 #include <stdio.h> #include <malloc.h> #include &l ...
- hdu3068
最长回文 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- Ajax+JSON学习笔记(二)
来源:http://www.imooc.com/learn/250 readyState属性 0:请求未初始化,open还没有调用 1:服务器连接已建立,open已经调用了 2:请求已接受,也就是接收 ...
- Web 网页常见问题集锦
1.如何去掉Chrome记住密码后自动填充表单的黄色背景 不知道大家有没有这样的烦恼,在Chrome浏览器中,记住密码后重新填写表单数据时,自动会有黄色背景的出现.(如图a) 图a 而出现这个黄色背景 ...