首页 > Windows开发 > 详细

WPF显示html的几种方法

时间:2016-05-05 12:39:44      阅读:316      评论:0      收藏:0      [点我收藏+]
原文:WPF显示html的几种方法

 

客户希望系统在一些特定的条件下,界面上能显示用户自定义的格式和内容,格式和内容通过html指定。

 

基本上在wpf中显示html有以下四种方法。

1.       Wpf Frame control

this.frame1.Navigate(uri);

this.frame1.Source = uri;

 

无法直接指定html内容。

 

2.       Wpf WebBrowser control

this.webBrowser1.Navigate(source);

this.webBrowser1.NavigateToStream(stream);

this.webBrowser1.NavigateToString(html);

this.webBrowser1.Source = uri;

 

NavigateToString可直接处理html内容的字符串,但不幸是方法而不是属性。

 

3.       使用Winform的webBrowser control

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/feab32d0-2d50-43e0-939a-7b20db7a4b54/

winform的webBrowser还是比较好用的,但是在wpf下需要引用System.Windows.Forms.dll and WindowsFormsIntegration.dll。

 

4.       将html转换成FlowDocument

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/9f0611de-9e7c-4a67-bc07-406844413e48/

这种办法太麻烦了

 

以上这4种方法都无法在xaml中直接处理,看来,如果仅仅是为了让用户能自定义界面,还是用自定义template的方法比较合适。

WPF显示html的几种方法

原文:http://www.cnblogs.com/lonelyxmas/p/5461269.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!