drk
drk

Reputation: 173

WPF Context Sensitive Help - Best Practice

I have created a wpf application for context sensitive help using .chm files. I have created a a context sensitive help by pressing F1 after clicking a textbox or a button, thorugh xaml, AND NOT BY EVENT HANDLING. , but I need it for window also. I can have the window help as default in xaml when the window is loaded itself, which works now. But if i use text box help, then I cant switch back to window help since I have not included any events for that.

For this scenario, is using events the only possibility to include window help? what is the best practice? Is there a way to use window focus on xaml itself, or using event ends up as the best practice?

thanks a lot !!

Upvotes: 2

Views: 2474

Answers (1)

jsirr13
jsirr13

Reputation: 1002

Why not just implement a F1 Help System? it's pretty straightforward...

Take a look at this example HERE. This provides a HelpProvider class that gives you context sensitive help on any element that sets a HelpString. This should provide roughly what you need.

In your case, just make the chm file name your help name for each element you want a file sensitive to. And you could have something like so:

static private void Executed(object sender, ExecutedRoutedEventArgs e)
{
    YourHelpSystem.ShowHelp(HelpProvider.GetHelpString(sender as FrameworkElement) + ".chm");
}

Upvotes: 1

Related Questions