Share via


How to push F1 context keywords for property pages in the project designer?

Background:

IPropertyPage.Help is not invoked on property pages integrated with the Application Designer. Consequently, you need to push an F1 keyword by calling IHelpService.AddContextAttribute, similar to what the VB .NET and C# project property pages do.

Solution:

Using the IronPython Integration sample as a test bed for illustration purposes, you can push an F1 context keyword as follows:

Add the following data member to the BuildPropertyPage in BuildPropertyPage.cs:

private System.IServiceProvider serviceProvider;

Override the SetPageSite method as follows:

public override void SetPageSite(Microsoft.VisualStudio.OLE.Interop.IPropertyPageSite theSite)

{

   base.SetPageSite(theSite);

   this.serviceProvider = (System.IServiceProvider)theSite;

}

Then override the Show method to call IHelpService.AddContextAttribute whenever the page is being shown. For example:

public override void Show(uint cmd)

{

   base.Show(cmd);

   if (cmd != 0 /*SW_HIDE*/)

   {

      IHelpService helpService = (IHelpService)serviceProvider.GetService(typeof(IHelpService));

      helpService.AddContextAttribute("Keyword", "ip.BuildPage", HelpKeywordType.F1Keyword);

   }

}

Finally, to test if your keyword is being pushed, modify the "HKCU\<root hive>\Dynamic Help\Display Debug Output in Retail" to "Yes" (without the quotations marks) .

Restart Visual Studio using the <root hive> specified above, and bring up the Dynamic Help Tool Window. At the bottom of the Dynamic Help Tool Window, you should see your keyword listed with any entry like:

   (Kwd) keyword=ip.BuildPage

Additional resources:

· Help Authoring and Integration

· Tutorial: How to Integrate Help Documentation into Visual Studio

Comments