I had to do some changes so here is the code that finally worked:
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Data.Services;
using System.Collections.Generic;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio;
namespace My.VisualStudio.Package
{
public class MyClassWindowPane : ToolWindowPane, IVsWindowFrameNotify2
{
public MyClassPanel MyClassPanelControl;
public List<IVsDataExplorerConnection> Connections { get; set; }
public string SelectedConnectionName { get; set; }
public MyClassWindowPane()
: base(null)
{
MyClassPanelControl = new MyClassPanel();
}
public void InitializeMyClassPanel()
{
MyClassPanelControl.LoadConnections(Connections, SelectedConnectionName);
}
override public IWin32Window Window
{
get { return (IWin32Window)MyClassPanelControl; }
}
}