CustomTaskPane in Word AddIn doesn't appear in second document

R

robert

Hi,
I'm (still) developing and AddIn for Word 2007 in C# using VSTO 2005.
It consists of a Ribbon extension and a CustomTaskPane.

It seems to work OK'ish. But I can't get it working when I start up
Word and open another document so that two Word windows are open. The
CustomTaskPane only appears in the first window. The ribbon contains a
button to toggle the visibility of the CustomTaskPane and when
clicking that on the second windows it is only the CustomTaskPane in
the first window that becomes hidden or shows.

The code that initialises the customtaskpane goes below and obviously
only gets executed once. Any suggestions where else I could put the
body of this code as to create other instances of the CustomTaskPane?

Thanks,

Rob



namespace WordAddIn1
{
public partial class ThisAddIn
{
internal CustomTaskPane ctp = null;

public void ThisAddIn_Startup(object sender, System.EventArgs e)
{

if (ctp == null)
ctp = this.CustomTaskPanes.Add(new UserControl1(), "My Custom Task
Pane");

ctp.Visible = true;

}

private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
}

}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top