Greetings.
I have a VSIX project that creates several instances of a ToolWindow. I want to know when one of the instances is getting activated. For example, somebody clicked on the appropriate VS window or selected it from the Window menu. I can't find any easy way of implementing it. I tried embedding a frame into the ToolWindow content and subscribing to GotFocus event:
private void MyHost_GotFocus(object sender, RoutedEventArgs e)
{
int lastInstance = toolWindow.Instance;
MyPackage myPackage = toolWindow.Package as MyPackage;
myPackage.SetLastInstance( lastInstance);
}Unfortunately this does not cut it, as this event only gets fired if I click inside the control. It is not enough to just have the ToolWindow activated. So far I could not find any other event that would signal activation of my ToolWindow. Does anybody know how this can be implemented?
Thank you in advance,
Victor.