在 WPF 应用程序中集成帮助
在 WPF 应用程序中集成本地(而非在线)帮助的可能方法有哪些?它更像是一本手册,但我想以某种方式整合它。
编辑:刚刚找到 http://wordtoxaml.codeplex.com,我会尝试一下。它将word文档转换为xaml,我可以在WPF中显示它。
编辑2:我找到了一个可行的解决方案:用word编写手册,另存为XPS,然后使用 https://web.archive.org/web/20111116005415/ http://www.umutluoglu.com/english/post/2008/12/20/Showing-XPS-Documents-with-DocumentViewer-Control-in-WPF.aspx
what are the possible approaches to integrate local (so not on-line) help in a WPF application? It would be more like a manual, but I would like to integrate it in some way.
EDIT: just found http://wordtoxaml.codeplex.com, I will try that one. It converts word document into xaml, which I can display in WPF.
EDIT 2: I found a working solution: write manual in word, save as XPS, and display it using https://web.archive.org/web/20111116005415/http://www.umutluoglu.com/english/post/2008/12/20/Showing-XPS-Documents-with-DocumentViewer-Control-in-WPF.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们使用 RoboHelp 并生成 chm 文件,有时称为 HTML 帮助文件。 .NET Framework 的
Help
类具有您调用的方法ShowHelp
,传递 chm 文件和要显示的主题。您可以告诉它按主题标题、ID 等显示。我们使用主题标题进行显示,因此调用如下所示:接下来,您可以创建一个名为 HelpProvider 的类,该类创建一个名为 HelpTopic 的附加属性。这允许您将 HelpTopic 属性附加到任何 FrameworkElement。该类还使用静态构造函数将内置 F1 帮助命令挂钩到命令处理程序,这些处理程序从源中检索附加属性并打开帮助。
完成此操作后,您可以通过如下代码调用帮助:
更好的是,现在您可以将帮助附加到 UI 中的任何 FrameworkElement,如下所示,
现在,当用户在窗口或任何元素上按 F1 时,他们会得到上下文相关的帮助。
We use RoboHelp and generate a chm file, sometimes referred to as an HTML Help file. The .NET Framework's
Help
class has a methodShowHelp
that you call, passing the chm file and the topic you want to display. You can tell it to display by topic title, by ID etc. We display using the topic title so the call looks like this:Next you can create a class called HelpProvider that creates an attached property called HelpTopic. This allows you to attach a HelpTopic property to any FrameworkElement. The class also uses the static constructor to hook the built-in F1 help command to command handlers that retrieve the attached property from the source and open the help.
With that in place, you can call your help from code like this:
What's even nicer, now you can attach help to any FrameworkElement in your UI like this,
Now when the user presses F1 on the windows or any element, they'll get context-sensitive help.
我有类似的需求,只不过我只需要将 F1 键连接到我们现有的帮助代码。
我最终混合了大约 5 个不同的 StackOverflow 页面,因此我将其放在这里,以防其他人有类似的需求。
在我的 MainWindow.xaml 中,我在 inputBindings 中添加了一个 KeyBinding,以将 F1 连接到 ICommand:
然后在我的 MainWindowViewModel.cs 中,我添加了这个 ICommand,它调用我现有的帮助代码。
我希望这对遇到类似问题的人有所帮助。
I had a similar need except I only needed to wire up the F1 key to our existing Help code.
I ended up pulling a mix of about 5 different StackOverflow pages so I'm putting it here in case someone else has a similar need.
In my MainWindow.xaml I added a KeyBinding in inputBindings to wire the F1 to an ICommand:
Then in my MainWindowViewModel.cs I added this ICommand which calls my existing Help code.
I hope this helps anyone with a similar issue.