private static void SetShowOnDisabled(DependencyObject dependencyObject, CommandToolTipStyle toolTipStyle) { if (toolTipStyle == CommandToolTipStyle.Always || toolTipStyle == CommandToolTipStyle.AlwaysWithKeyGesture) { ToolTipService.SetShowOnDisabled(dependencyObject, true); } }
private static object FormatToolTip(ClientCommand command, string toolTip, CommandToolTipStyle toolTipStyle) { if (command == null) { throw new ArgumentNullException("command"); } if (toolTipStyle == CommandToolTipStyle.None || string.IsNullOrEmpty(toolTip)) { return(null); } if (toolTipStyle != CommandToolTipStyle.AlwaysWithKeyGesture && toolTipStyle != CommandToolTipStyle.EnabledWithKeyGesture) { return(toolTip); } if (command.UICommand.InputGestures.Count > 0) { KeyGesture keyGesture = command.UICommand.InputGestures[0] as KeyGesture; if (keyGesture != null && keyGesture.DisplayString.Length > 0) { toolTip = string.Format(ToolTipKeyGestureFormat, toolTip, keyGesture.DisplayString); } } return(toolTip); }
private static object GetCommandToolTip(ClientCommand command, CommandToolTipStyle toolTipStyle) { if (command == null) { throw new ArgumentNullException("command"); } if (toolTipStyle == CommandToolTipStyle.None) { return(null); } return(command.Meta.ToolTip.Translate()); }
public static void SetupTooltip(FrameworkElement item, ClientCommand command, CommandToolTipStyle toolTipStyle) { // tooltip if (item.ToolTip == null && command != null) { item.ToolTip = GetCommandToolTip(command, toolTipStyle); } if (item.ToolTip is string && command != null) { item.ToolTip = FormatToolTip(command, item.ToolTip as string, toolTipStyle); } SetShowOnDisabled(item, toolTipStyle); }