显示的HTML WinRT中与RichTextBlock或其他组件 [英] Showing Html in WinRT with RichTextBlock or other component

查看:260
本文介绍了显示的HTML WinRT中与RichTextBlock或其他组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示HTML字符串中的一些组件。现在,我使用RichTextBlock,我尝试一些扩展HTML转换为XAML或rtf但我发现didn't任何与WinRT的工作。我知道我可以使用的WebView但isn't这么漂亮。我只想做一点改变 ItemDetailPage (其中用于RichTextBlock)向用户显示基本的HTML(粗体,斜体,链接,图像,...)。

I want to show html in string with some component. Now I am using RichTextBlock and I tried few extensions for converting html to xaml or rtf but I didn´t found any working with WinRT. I know I can use WebView but it isn´t so pretty. I just want to do little change to ItemDetailPage (where is used RichTextBlock) to show users elementary html (bold, italics, links, images, ...).

有一些组件或者某种方式如何做到这一点(没有web视图)?或者是有工作的转换器?

Is there some component or some way how to do this (not webview)? Or is there working convertor?

推荐答案

您有两种方式。


  1. 建造或获得自己的HTML XAML分析器使用内容的RichTextBox源

  2. 使用的WebView显示HTML内容

我推荐的WebView,因为这componente有很多的功能,这是非常难以实施作为一个解析器

I recommend WebView because this componente have a lot of features that is very difficult to implement as a parser


  • 的javascript支持

  • 对CSS的支持

  • 坏的形成(真实世界)支持HTML


  • javascript support
  • css support
  • bad formed (real world) html support
  • etc

所以,在一个WebView控件,您可以使用WebView.NavigateToString方法来显示存储在一个字符串的HTML内容。

So, in a WebView control you can use WebView.NavigateToString method to display html contents stored in a string.

哟可以,甚至,修改字符串以改变风格,添加脚本,等等,因为你需要定制的web视图的外观和感觉。

Yo can, even, modify string to changes styles, add scripts, etc as you need to custom webview look and feel.

NavigateToString有不支持结合但我写了一篇文章(西班牙语)教学如何使用附加属性做:的 http://blogs.msdn.com/b/juank/archive/2012/10/29/tutorial-crear-app-lector-rss- WinRT的-单方面-7.aspx

NavigateToString has no support for binding but I wrote an article (spanish) teaching how to doing using attached properties: http://blogs.msdn.com/b/juank/archive/2012/10/29/tutorial-crear-app-lector-rss-winrt-parte-7.aspx

使用此代码(丛),以解析,如果不适合它到底可以改变为自己的TE代码。 ;) http://html2xaml.codeplex.com/

Use this code(plex) to parsing, if it not fit exactly you can change te code for your own. ;) http://html2xaml.codeplex.com/

其他明智的,你会自己创建的颂歌,如果你想打破列的文字页面(横向读),你必须使用RichTextBlock,使用RichTextColumns赫普勒类(包括普通/文件夹,当你开始从模板您的应用程序),并尝试解析HTML到XAML。

Other wise you would create the ode yourself, if you want break pages in column text (to horizontal reading) you must use RichTextBlock, use RichTextColumns hepler class ( included in Common/ folder when you start your app from a template) and try to parse HTML to XAML.

这篇关于显示的HTML WinRT中与RichTextBlock或其他组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆