将 HTML 转换为 XAML

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1099798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:11:20  来源:igfitidea点击:

Convert HTML to XAML

htmlwpfxaml

提问by tom7

Is there a way to convert HTML into XAML? I noticed that you can paste HTML into a RichTextBox and you can get the XAML by looking at the FlowDocument. However, this is a hack. Is there a better way?

有没有办法将 HTML 转换为 XAML?我注意到您可以将 HTML 粘贴到 RichTextBox 中,并且您可以通过查看 FlowDocument 来获取 XAML。然而,这是一个黑客。有没有更好的办法?

采纳答案by Thomas Levesque

I don't think it's possible to do an exact conversion from HTML to XAML, because there isn't a one to one equivalence between the two.

我认为不可能进行从 HTML 到 XAML 的精确转换,因为两者之间没有一一对应的关系。

There are a few tools that may help you, but don't expect a perfect result :

有一些工具可以帮助您,但不要期望得到完美的结果:

http://msdn.microsoft.com/en-us/library/aa972129.aspx

http://msdn.microsoft.com/en-us/library/aa972129.aspx

http://windowsclient.net/downloads/folders/controlgallery/entry2313.aspx

http://windowsclient.net/downloads/folders/controlgallery/entry2313.aspx