【发布时间】:2013-03-01 16:13:32
【问题描述】:
我在 Excel 的上下文菜单中有一个 CommandBarPopup,其中包含三个 CommandBarButtons,其中一个按钮打开网页,另外两个打开自定义任务窗格。
如果我使包含托管 WPF 用户控件的元素宿主的自定义任务窗格可见,那么我添加的任何 CommandBarButtons 都将停止工作。 即使我关闭了自定义任务窗格,它仍然无法正常工作。
如果我对自定义任务窗格容器和网络浏览器执行相同操作,它似乎可以正常工作。
这是我们正在使用的代码
private void InitializeComponent()
{
this.elementHost1 = new System.Windows.Forms.Integration.ElementHost();
this.myView = new MyView();
this.SuspendLayout();
//
// elementHost1
//
this.elementHost1.Dock = System.Windows.Forms.DockStyle.Fill;
this.elementHost1.Location = new System.Drawing.Point(0, 0);
this.elementHost1.Name = "elementHost1";
this.elementHost1.Size = new System.Drawing.Size(780, 560);
this.elementHost1.TabIndex = 0;
this.elementHost1.Text = "elementHost1";
this.elementHost1.Child = this.myView;
//
// MyTaskPane
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.elementHost1);
this.Name = "MyTaskPane";
this.Size = new System.Drawing.Size(780, 560);
this.ResumeLayout(false);
}
【问题讨论】:
-
投票结束这个问题的人想要解释为什么?
标签: excel wpf-controls vsto excel-2010 excel-addins