public void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { IInputElement focusedControl = FocusManager.GetFocusedElement(Application.Current.Windows[0]); if (focusedControl is DependencyObject) { string str = HelpProvider.GetHelpKey((DependencyObject)focusedControl); HelpProvider.ShowHelp(str); } }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { Window activeWindow = Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive); IInputElement focusedControl = FocusManager.GetFocusedElement(activeWindow); if (focusedControl is DependencyObject) { string str = HelpProvider.GetHelpKey((DependencyObject)focusedControl); HelpProvider.ShowHelp(str); } else { string str = HelpProvider.GetHelpKey((DependencyObject)activeWindow); HelpProvider.ShowHelp(str); } }