WPF提供帮助文档.txt

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

帮助模块:HelpProvider想用的可以去msdn上查一查,不过这货是windows.forms里的东西,不能在wpf里面用,坑爹呢啊这是,不过在网上找到了一个高人应该算是在wpf里重写了这个HelpProvider,这就让我们写wpf的也可以好好用了,代码经过测试,妥妥的。
namespace ContextSensitiveHelp
{
    /// <summary>
    /// This class provides the ability to easily attach Help functionality to Framework elements.
    /// To use it, you need to add a reference to the HelpProvider in your XAML.
    /// The FilenameProperty specifies the name of the help file, and the KeywordProperty specifies the keyword to be used with the search.
    /// </summary>
    /// <remarks>
    /// The FilenameProperty can be at a higher level of the visual tree than the KeywordProperty, so you don't need to set the filename each time.
    /// </remarks>
    static class HelpProvider
    {
        static HelpProvider()
        {
            CommandManager.RegisterClassCommandBinding(typeof(FrameworkElement),
                new CommandBinding(ApplicationCommands.Help,
                    new ExecutedRoutedEventHandler(Executed),
                    new CanExecuteRoutedEventHandler(CanExecute)));
        }
        #region Filename
        /// <summary>
        /// Filename Attached Dependency Property
        /// </summary>
        public static readonly DependencyProperty FilenameProperty =
          DependencyProperty.RegisterAttached("Filename", typeof(string), typeof(HelpProvider));
        /// <summary>
        /// Gets the Filename property.
        /// </summary>
        public static string GetFilename(DependencyObject d)
        {
            return (string)d.GetValue(FilenameProperty);
        }
        /// <summary>
        /// Sets the Filename property.
        /// </summary>
        public static void SetFilename(DependencyObject d, string value)
        {
            d.SetValue(FilenameProperty, value);
        }
        #endregion
        #region Keyword
        /// <summary>
        /// Keyword Attached Dependency Property
        /// </summary>
        public static readonly DependencyProperty KeywordProperty =
          DependencyProperty.RegisterAttached("Keyword", typeof(string), typeof(HelpProvider));
        /// <summary>
        /// Gets the Keyword property.
        /// </summary>
        public static string GetKeyword(DependencyObject d)
        {
            return (string)d.GetValue(KeywordProperty);
        }
        /// <summary>
        /// Sets the Keyword property.
        /// </summary>
        public static void SetKeyword(DependencyObject d, string value)
        {
            d.SetValue(KeywordProperty, value);
后面还有 46 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。