Saturday, September 8, 2012

Displaying Context Sensitive Help With WPF

I've been working on a small WPF task management app and decided to write a help file for it using HTML Help Workshop. After completing the help file, I wanted to tie my application into the CHM file, displaying the topic relevant for the current window. Strangely, I was not able to find a lot of good examples that tied this approach all together. Apparently, this is not something that people commonly do. Anyway, below is an example of how to pull it off.

Help.ShowHelp(null, "help.chm", "html/active_tasks/search.htm");
The part that was tripping me up was that the third parameter, which is named "keyword", is actually a URL to the page within your help file that you want to display. There's an MSDN article that describes it a little further, although the code example does not make it extremely obvious. Here's the article that finally got me over the hump.

No comments:

Post a Comment