Inserting an HTML fragment into a WPF FlowDocument

2019-03-19 16:12发布

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.

2条回答
smile是对你的礼貌
2楼-- · 2019-03-19 16:30

Answered my own question...

System.Windows.Markup.XamlReader.Parse()
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-03-19 16:34

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

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

查看更多
登录 后发表回答