如何在Excel动作窗格内使用WPF控件? [英] How to Use WPF Controls Inside an Excel Actions Pane?

查看:103
本文介绍了如何在Excel动作窗格内使用WPF控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

那里有一些资源说明如何将 WinForms 控件添加到Excel.看到这两个:

There are several resources out there that explain how to add WinForms controls to Excel. See these two:

http://msdn .microsoft.com/en-us/library/vstudio/e3zbk0hz%28v = vs.100%29.aspx

http ://www.clear-lines.com/blog/post/create-excel-2007-vsto-add-in-wpf-control.aspx

他们两个都提到了使用 WPF控件(我需要的一种)的最新选项.不幸的是,这两种资源都缺少基本部分.缺少链接:

Both of them mention the more up-to-date option of using WPF controls (the one I need). Unfortunately, both resources are lacking the fundamental part. There is a missing link:

(1)Microsoft网站提到了一些视频,其名称恰好符合我的要求,但该网站中的所有视频似乎都已删除.

(1) The Microsoft site mentions some video -with the exact title that matches my requirement- but all videos in that web site have been removed, it seems.

(2)Clear-Lines站点包含一个出色的分步项目,但可惜的是,当提到关键部分时,作者使用了某些工具(工具箱的WPF互操作性"部分)存在于VS-2010 +

(2) The Clear-Lines site contains an outstanding, step-by-step project but alas, when the critical part is mentioned, the author uses some facility (the "WPF Interoperability section of the Toolbox") that does not exist in VS-2010+

基于上述屏幕截图和其他网站,我得出的结论是,缺少的链接,我的WPF用户控件与其在Excel中的外观之间的连接是某些ElementHost.

Based on the above screenshots, and other sites, I have come to the conclusion that the missing link, the connection between my WPF UserControl and its appearance in Excel is some ElementHost.

@HighCore的附录.请参见下面的工具箱:

Addendum for @HighCore. See Toolbox below:

推荐答案

尊敬的自我:

您的问题是您试图将 WPF控件放置在另一个 WPF控件中.

Your problem is that you are trying to place a WPF Control inside another WPF Control.

您需要创建一个老式的 WinForm控件,然后使用如下所示的工具箱:

You need to create an old-fashioned WinForm Control and next you use the Toolbox as depicted here:

请注意, ElementHost任务部分已重命名为 WPF互操作性,但它仍然非常活跃.

Notice that the section ElementHost Tasks has been renamed WPF Interoperability but it is otherwise very much alive.

来自MSDN杂志:

http://msdn.microsoft.com/en-us /magazine/cc163292.aspx#S4

这篇关于如何在Excel动作窗格内使用WPF控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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