简体   繁体   English

在WPF中呈现HTML内容的最佳控件是什么?

[英]What is the best control for rendering HTML content in WPF

My objective is to show the HTML content with style in my WPF application. 我的目标是在WPF应用程序中以样式显示HTML内容。 I am getting a HTML content as response from a API. 我从API获得HTML内容作为响应。 I need to show the content in a frame ( preferably textblock). 我需要在框架(最好是文本块)中显示内容。 I tried with webbrowser control of wpf where I faced many issues on formatting over the grid and I am not able to show transparent background for webbrowser control. 我尝试使用wpf的webbrowser控件时,在网格上格式化时遇到许多问题,但我无法显示webbrowser控件的透明背景。 I found the issue is due to this . 我发现问题是由于

Sample HTML content : 示例HTML内容:

<p>My <b>para<b></p><ul> <li>My list1</li> <li>My list2</li></ul>

I researched over the internet and found some control for wpf. 我在互联网上进行了研究,发现了对wpf的控制。

Awesomium 牛s

WPF Chromium WPF铬

I am newbie to WPF C# and I don't have idea about how to use the controls in my wpf application. 我是WPF C#的新手,我对如何在wpf应用程序中使用控件一无所知。 I tried with some sample application from here and here . 我从这里这里尝试了一些示例应用程序。 However, It showing lot of error due to reference missing. 但是,由于缺少参考,显示很多错误。

Also I tried with HtmltoXaml converter and WPF Rich box and found that it skips many of the content after rendering. 我也尝试过使用HtmltoXaml转换器和WPF Rich框,发现它在渲染后会跳过许多内容。

It would be really helpful for me if I get a simple sample wpf application working without error implemented with above mentioned controls or links that are useful. 如果我得到一个简单的示例wpf应用程序,并且使用上述有用的控件或链接没有实现错误,这对我来说真的很有帮助。

Any new idea to overcome my issue also appreciated. 任何克服我的问题的新主意也表示赞赏。 Thanks in advance and sorry for my English. 在此先感谢您,我的英语很抱歉。

If you need a html5 rendering browser, I'd recommend CEFSharp. 如果您需要html5呈现浏览器,建议使用CEFSharp。 It's nugettable, stable and is synced with the latest Chromium code. 它易于食用,稳定,并与最新的Chromium代码同步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM