在WPF FlowDocument中嵌入自定义控件 [英] Embed custom control in WPF FlowDocument

查看:182
本文介绍了在WPF FlowDocument中嵌入自定义控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将自定义控件嵌入到flowDocument中,并由FlowDocument查看器正确显示(将其导出到Xaml文本文件并由查看器打开)?

解决方案

如果使用自定义控件是指UserControl或从WPF控件继承的任何自定义控件,则不能:此自定义控件位于其自己的XML名称空间中,并且需要部署代码在装配中。



您只能使用Microfost提供的控件,并通过以下控件进行部署:XAML阅读器在尝试解析文件时将无法访问它,并且不会成功。观众。也许可以让查看者知道GAC中部署的程序集,但这仅是可以在客户端GAC中部署的解决方案。

Is there any way to embed a custom control into the flowdocument and have it correctly displayed by the FlowDocument viewers (export it to Xaml text file and open it by a viewer)?

解决方案

If by custom control you mean UserControl or any custom control inherited from a WPF control, you can't: This custom control is in its own XML namespace, and requires code deployed in an assembly. Your XAML reader won't have access to it when attempting to parse the file, and won't succed.

You can only use controls provided by Microfost, and deployed with the viewer. Maybe it's possible to make viewers know of assemblies deployed in the GAC, but it's a solution only if you can deploy in the client GAC.

这篇关于在WPF FlowDocument中嵌入自定义控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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