我已经在开发一个WPF应用程序一段时间了,现在需要将CHM格式的帮助文档添加到它上面。
但是!HelpProvider,在Winforms中显示CHM文件的标准方式,已经神秘地消失了,并且在WPF中没有相对应的工具。我一直在尝试使用WindowsFormsHost来生成一个新的控件,以便实际显示帮助文档,但它基本上只控制了整个UI。
更多细节:我有一个菜单项,我想要当用户点击时打开CHM文件。
首先,我设置了WindowsFormsHost...
host = new System.Windows.Forms.Integration.WindowsFormsHost();
helpForm = new System.Windows.Forms.Control();
host.Child = helpForm;
host.Visibility = System.Windows.Visibility.Hidden;
this.grid1.Children.Add(host);
hp = new System.Windows.Forms.HelpProvider();
hp.HelpNamespace = "Somehelpfile.chm";
hp.SetHelpNavigator(helpForm, System.Windows.Forms.HelpNavigator.TableOfContents);
然后我说,瞧,显露你自己。
private void Help_Click(object sender, RoutedEventArgs e)
{
host.Visibility = Visibility.Visible;
helpForm.Show();
hp.SetShowHelp(helpForm, true);
}
我不太确定接下来该怎么做。当我显示helpForm时,它会遮盖/覆盖现有的UI,并且我只得到一个空的灰色WPF窗口,没有帮助文件。
有人能帮忙吗?