예제 #1
0
        protected virtual string GetItemToolTip(ICommand command, FrameworkElement source, string applicationName)
        {
            string CommandText = DocumentHelper.GetToolTipText(command, source);
            string GestureText = GestureHelper.GetGestureText(command, source);

            if (CommandText.Contains(LocalizedRoutedCommand.ApplicationNamePattern) && applicationName != null)
            {
                CommandText = CommandText.Replace(LocalizedRoutedCommand.ApplicationNamePattern, applicationName);
            }

            string ItemToolTip;

            if (CommandText != null)
            {
                if (GestureText != null)
                {
                    ItemToolTip = CommandText + " " + "(" + GestureText + ")";
                }
                else
                {
                    ItemToolTip = CommandText;
                }
            }
            else
            {
                ItemToolTip = null;
            }

            return(ItemToolTip);
        }
예제 #2
0
        /// <summary>
        /// Gets the gesture text of a command for a source element.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="source">The source element.</param>
        /// <returns>The gesture text.</returns>
        protected virtual string GetItemGestureText(ICommand command, FrameworkElement source)
        {
            string GestureText = GestureHelper.GetGestureText(command, source);

            return(GestureText);
        }