ToolWindow using WPF

Hey,
I would like to use a WPF definition for my ToolWindow but I have some trouble with the Registrar. I created a new xaml UserControl (class that extends UserControl) with a C'tor that takes IVsUIShell as argument. When I try to register it like here in the documentation [1]:

var window = new SomeUserControl(shell);

return window.BindToLifetime(lt);


It tells me that the Type SomeUserControl must be convertible to System.Windows.Forms.Control in order to use it as parameter T in the generic method BindToLifetime. Using ReSharper-provided controls works fine. Or do I have to add WPF Controls to my xaml and register them instead of the whole class?

Also it seems that the documentation is outdated for resharper 8. There is no ToolWindowDescriptor attribute called Id and Guid anymore. The id is now called ProductNeutralId and the guid was removed. Adding a working example for wpf forms and ToolWindows would be nice,
the documentation for Optionpages and Wpf is much more extensive.  

Regards T0a



[1] http://confluence.jetbrains.com/display/NETCOM/4.10+Tool+Windows+%28R8%29 

1 comment
Comment actions Permalink

Oops. Good spot on the docs, I'll add it to the list to be updated.

ToolWindows content is actually a type called EitherControl, which is a wrapper around both Control and UIElement, so it allows you to use either Windows Forms or WPF as the content. The BindToLifetime method you should be calling there is an instance method on EitherControl, but you're trying to call an extension method on Control, which is why ReSharper is telling you that you need to be convertible to Control. Create a new EitherControl(myUserControl) and then call BindToLifetime.

Thanks
Matt

0

Please sign in to leave a comment.