首先,它是一个基于文档的VSTO项目(所以那些插件VSTO演练并不能真正工作)。
我能够创建一个ActionPaneControl,并且能够使用ElementHost在其中添加一个WPF用户控件。启动它的代码如下所示:
ActionsPaneControl1 apc = new ActionsPaneControl1();
Globals.ThisWorkbook.ActionsPane.Controls.Add(apc);
Globals.ThisWorkbook.ActionsPane.Visible = true;但是,我正在尝试向WPF用户控件传递一个参数。然后我意识到,在这段代码中没有地方指示WPF用户控件。我的猜测是这与ElementHost有关。
有谁能帮帮忙吗?
谢谢
编辑:这是ActionPaneControl1类
partial class ActionsPaneControl1
{
private System.ComponentModel.IContainer components = null;
.....
private void InitializeComponent()
{
this.elementHost1 = new
System.Windows.Forms.Integration.ElementHost();
this.elementHost2 = new
System.Windows.Forms.Integration.ElementHost();
this.ucWPF1 = new SWAPAEMonthlyReview.ucWPF();
.....
}https://stackoverflow.com/questions/47823545
复制相似问题