Inserting an HTML fragment into a WPF FlowDocument

蹲街弑〆低调 提交于 2019-12-03 17:17:50

问题


I'm dynamically building a WPF FlowDocument from a datasource. One of the data elements is a fragment of HTML - I need to figure out a way to parse that and insert it into my FlowDocument.

I've found HTMLToXAMLConverter which will return a XAML representation of the HTML, but I'm still not sure how to best go about instantiating that XAML fragment so I can insert it into my FlowDocument.


回答1:


Answered my own question...

System.Windows.Markup.XamlReader.Parse()



回答2:


Had same problem, but had to solve databinding problems as well

Had a convector that created XAML from string and vice-verse.



来源:https://stackoverflow.com/questions/698026/inserting-an-html-fragment-into-a-wpf-flowdocument

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!