public static FrameworkElement GetHelpButton(string helpUri, HelpButtonMode helpButtonMode, Uri iconSource, ICommand clickCommand)
        {
            FrameworkElement frameworkElement = null;
            string           helpContentKey   = "HelpHeader";

            switch (helpButtonMode)
            {
            case HelpButtonMode.RibbonButton:
                RibbonButton ribbonButton = new RibbonButton();
                ribbonButton.LargeImageSource = new BitmapImage(iconSource);
                ribbonButton.SmallImageSource = new BitmapImage(iconSource);
                ribbonButton.SetResourceReference(RibbonButton.LabelProperty, helpContentKey);
                ribbonButton.Click += NavigateToHelpUri_Click;
                frameworkElement    = ribbonButton;
                break;

            case HelpButtonMode.IconWithLabel:
                StackPanel stackPanel = GetButtonContainer(helpUri, helpContentKey, iconSource);
                stackPanel.MouseLeftButtonUp += NavigateToHelpUri_Click;
                frameworkElement              = stackPanel;
                break;

            case HelpButtonMode.IconOnly:
                frameworkElement = GetImageButton(iconSource);
                frameworkElement.MouseLeftButtonUp += NavigateToHelpUri_Click;
                break;

            case HelpButtonMode.Default:
            case HelpButtonMode.NormalButton:
            default:
                Button button = new Button {
                    Content = GetButtonContainer(helpUri, helpContentKey, iconSource)
                };
                button.Click    += NavigateToHelpUri_Click;
                frameworkElement = button;
                break;
            }

            frameworkElement.SetResourceReference(FrameworkElement.ToolTipProperty, helpContentKey);
            frameworkElement.Tag = string.IsNullOrEmpty(helpUri) ? (object)clickCommand : helpUri;
            return(frameworkElement);
        }
 public static FrameworkElement GetHelpButton(string helpUri, HelpButtonMode helpButtonMode, ICommand clickCommand = null)
 {
     return(GetHelpButton(helpUri, helpButtonMode, new Uri(helpIcon, UriKind.Absolute), clickCommand));
 }
示例#3
0
        public static FrameworkElement GetHelpButton(string resourceKey, HelpButtonMode helpButtonMode, Uri iconSource, RelayCommand clickCommand)
        {
            string helpUri = GisEditor.LanguageManager.GetStringResource(resourceKey);

            return(HelpButtonHelper.GetHelpButton(helpUri, helpButtonMode, iconSource, clickCommand));
        }