14

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.

Jason
  • 86,222
  • 15
  • 131
  • 146
  • For anybody who doesn't want to deal with FlowDocument : https://stackoverflow.com/questions/7720946/displaying-html-in-wpf-using-mvvm/61226039#61226039 – SerjG Apr 15 '20 at 10:04

2 Answers2

15

Answered my own question...

System.Windows.Markup.XamlReader.Parse()
Jason
  • 86,222
  • 15
  • 131
  • 146
0

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

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

Daniil Harik
  • 4,619
  • 10
  • 55
  • 60