什么是Android的Html.fromHtml()在WP7的相同呢? [英] What is the equivalent of Android's Html.fromHtml() in WP7?

查看:142
本文介绍了什么是Android的Html.fromHtml()在WP7的相同呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个快速和肮脏的方式来呈现HTML在一个时尚类似Android的一个TextBlock Html.fromHtml()?我知道如何手动与类似的HtmlAgilityPack解析它,但我真正想要的是它呈现像它在文本块源。

Is there a quick and dirty way to render HTML in a textblock in a fashion similar to Android's Html.fromHtml()? I am aware of how to manually parse it with something like the HtmlAgilityPack, but all I really want is for it to render like its source in the textblock.

如果没有天真地话,或许有某种自定义的控制,不,我不想呈现为一个网页。

If not naively then perhaps with a custom control of some sort and, no I don't want to render it as a web page.

推荐答案

好吧对不起了这么久。我所有,但忘了如何正确使用git,并没有上传到现在的时间。这HtmlTextBlock提供了一个类似的功能水平,以它对应的Silverlight是pretty接近Android的当量。它还是一个有时有点马车与像HTML标签DTD更复杂的标签打交道时,但做这项工作....
WP7 HTML文本块。该设计主要是基于这个家伙的<一个href=\"http://blogs.msdn.com/b/delay/archive/2007/09/10/bringing-a-bit-of-html-to-silverlight-htmltextblock-makes-rich-text-display-easy.aspx\"相对=nofollow>带来-A-位的-HTML到Silverlight的htmltextblock,使丰富的文本显示,方便。和重写使用HTML敏捷Web浏览器相关的类。有一天,我会发布的细节,但是,等等...现在不行。笑

Ok sorry it took so long. I all but forgot how to use git correctly and hadn't had the time to upload till now. This HtmlTextBlock offers a similar level of functionality as to that of its silverlight counterpart which is pretty close to the android equivalent. Its still a bit buggy at times when dealing with more complex tags like the html dtd tag but does the job.... WP7 Html Text Block. The design is largely based on this guy's Bringing-a-bit-of-html-to-silverlight-htmltextblock-makes-rich-text-display-easy. and rewriting the web browser related classes using html agility. One day I'll post the details but, blah... Not right now. lol

更新

Update

使用示例:

<local:HtmlTextBlock x:Name="htmlTextBlock" Canvas.Left="2" Canvas.Top="2" TextWrapping="Wrap" UseDomAsParser="true" Text="<p>Your Html here </p>" />

请注意:你的HTML将不得不进行转义,使得&放大器; LT = LT;和&安培; GT =>

Note: Your html will have to be escaped such that &lt = < and &gt = >

有关详细用法见:

<一个href=\"https://github.com/musicm122/WP7HtmlTextBlock-/blob/master/HtmlTextBlockTest/HtmlTextBlockTest/MainPage.xaml\" rel=\"nofollow\">https://github.com/musicm122/WP7HtmlTextBlock-/blob/master/HtmlTextBlockTest/HtmlTextBlockTest/MainPage.xaml

这篇关于什么是Android的Html.fromHtml()在WP7的相同呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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