Visual Studio 2010: using a custom winforms element in a VSPackage tool window

When creating a simple VSPackage using the tool window, a sample WPF user control is created and added to the tool window. Should this user manage WPF? I have a custom winforms element, and adding it to the tool window does not display it. tried to host it in WPF without success. is there a standard way to do this?

+4
source share
2 answers

I ran into the same problem. I searched a lot. Could not find an answer or sample. Finally posted on msdn forum. Got my answer. Here is a link to the msdn forum thread

Link to the MSDN forum topic

ToolWindowPane can be used to host the contents of a WPF or Winform control.

For a Winform control, you just need to override the Window property and leave the Content null property.

For instance:

public MyToolWindow() : base(null) { this.Caption = Resources.ToolWindowTitle; this.BitmapResourceID = 301; this.BitmapIndex = 1; control = new MyControl(); } override public System.Windows.Forms.IWin32Window Window { get { return (System.Windows.Forms.IWin32Window)control; } } 
+4
source

I am pretty sure that these can also be winforms, and I'm sure there is somewhere on MSDN. I'll see if I can ever dig it out.

0
source

All Articles