将HTML片段插入到WPF FlowDocument中 [英] Inserting an HTML fragment into a WPF FlowDocument

查看:274
本文介绍了将HTML片段插入到WPF FlowDocument中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从数据源动态构建WPF FlowDocument。其中一个数据元素是HTML的一个片段 - 我需要找出一种解析方法并将其插入到我的FlowDocument中。



我发现 HTMLToXAMLConverter 它将返回HTML的XAML表示,但我' m仍然不确定如何最好地实例化该XAML片段,以便将其插入到我的FlowDocument中。 解决方案

问题...
$ b $ pre $ System.Windows.Markup.XamlReader.Parse()


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.

解决方案

Answered my own question...

System.Windows.Markup.XamlReader.Parse()

这篇关于将HTML片段插入到WPF FlowDocument中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆