ユーザーが F1 を押したときにヘルプ ファイルを表示したいと思います。デフォルトのヘルプ ファイルが表示されないようにするにはどうすればよいですか? 私は次のことをしました:
public static class HelpProvider
{
#region DependencyProperty [SourceProperty]
public static readonly DependencyProperty SourceProperty =
DependencyProperty.RegisterAttached("Source", typeof(string), typeof(HelpProvider),
new PropertyMetadata(OnSourcePropertyChanged));
public static string GetSource(DependencyObject obj)
{
return (string)obj.GetValue(SourceProperty);
}
public static void SetSource(DependencyObject obj, string value)
{
obj.SetValue(SourceProperty, value);
}
public static void OnSourcePropertyChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue == null || !(e.NewValue is string)) return;
var element = sender as FrameworkElement;
if (element != null)
element.KeyDown += element_KeyDown;
}
#endregion
#region Method
static void element_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key != Key.F1) return;
e.Handled = true;
if (GetSource(sender as DependencyObject) != null)
{
ShowHelpFile(GetSource(sender as DependencyObject));
}
}
private static void ShowHelpFile(string helpContext)
{
if (!DesignerProperties.IsInDesignTool)
{
/* Putting the invoking in UIThreadAsync:
* http://stackoverflow.com/questions/808030/reentrancy-was-detected
*/
HtmlPage.Window.Invoke("OpenHelpWindow", new object[] { filePath });
}
}
#endregion
}
OpenHelpWindow
これは、ウィンドウを開いた JS のメソッドです。デフォルトのヘルプ ウィンドウを表示しないというアイデアはありましたか?新しいデザインの新しいアイデアをここに紹介できれば幸いです。
ありがとう