Is there anyway to display HTML from a string variable to the TextBlock in WPF?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Maybe you can use this WPF Html supported TextBlock
回答2:
Can't do it in TextBlock, you need a WebBrowser control (or Frame, but it is obsolete). Feed descriptions, btw, can contain JavaScript - would be pretty hard for TextBlock to handle ;)
回答3:
string html = "<div>hi</div>
<div> </div>
<p>this is the new line <br /><br />second line</p>
<p>third line</p>
";
TextBlock.Text = Windows.Data.Html.HtmlUtilities.ConvertToText(html);