views:

14

answers:

0

I have a simple Visual Studio AddIn that exposes documentation and snippets, each on a separate tool windows. Both use the same UserControl. At any time, the user can double-click on document items inside the tool window to open the document item inside another Tool Window, that shows up in Visual Studio's documents zone (right next to the Start Page).

  • My problem

    If I dock the tool windows (both) next to the solution explorer and then close Visual Studio; when I reopen VS, my tool windows are docked at the same place.

    BUT

    If I dock the tool windows next to the solution explorer, double-click on a document item, and then close Visual Studio; when I reopen VS, my tool windows are undocked.

  • How my tool windows are created :

private Window CreateToolWindow( string name, string guid )
{
object objTemp = null;            
Assembly asm = Assembly.GetExecutingAssembly();
string asmPath = asm.Location; 
EnvDTE80.Windows2 toolWins = (Windows2)m_applicationObject.Windows;

Window win = toolWins.CreateToolWindow2(m_addInInstance, asmPath, HOST_CONTROL_NAME, name, guid, ref objTemp);

if (win != null)
{
   win.Visible = true;
   win.IsFloating = false;
}
return win;
}
  • How the document item window is created :
string title = "some title";
string url = "http://some.url";

if (m_browserWindow == null)
{
   object obj = null;
   Windows2 windows2 = m_applicationObject.Windows as Windows2;
   Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(WebBrowser));

   m_browserWindow = windows2.CreateToolWindow2(this.m_addInInstance, asm.Location,   "System.Windows.Forms.WebBrowser", title, BROWSER_WINDOW_GUID, ref obj);
   m_browser = obj as WebBrowser;

   m_browserWindow.Linkable = false;
   m_browserWindow.IsFloating = false;
}

if( m_browser != null )
   m_browser.Url = new Uri(url);

m_browserWindow.Caption = title;
m_browserWindow.Visible = true;
  • What I found so far :

    My tool windows LinkedWindowFrame changes to the window that gets created when opening a document item (the one next to the Start Page).

Question

How can I prevent this problem from happening

Any clues ? I have search the interwebs for a few days, without any hints...