public ToolBarButton(UIElement inputBindingOwner, Codon codon, object caller, IReadOnlyCollection <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.Command = CommandWrapper.CreateLazyCommand(codon, conditions); this.CommandParameter = caller; if (codon.Properties.Contains("template") || codon.Properties.Contains("style") || codon.Properties.Contains("packIconKey")) { ToolBarService.CreateTemplatedToolBarItem(this, codon); } else { this.Content = ToolBarService.CreateToolBarItemContent(codon); } this.conditions = conditions; if (codon.Properties.Contains("name")) { this.Name = codon.Properties["name"]; } if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); MenuCommand.AddGestureToInputBindingOwner(inputBindingOwner, kg, this.Command, GetFeatureName()); this.inputGestureText = MenuService.GetDisplayStringForShortcut(kg); } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.ButtonStyleKey); }
public MenuCommand(UIElement inputBindingOwner, Codon codon, object caller, string activationMethod, IReadOnlyCollection <ICondition> conditions) : base(codon, caller, conditions) { this.ActivationMethod = activationMethod; this.Command = CommandWrapper.CreateLazyCommand(codon, conditions); this.CommandParameter = caller; if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); AddGestureToInputBindingOwner(inputBindingOwner, kg, this.Command, GetFeatureName()); this.InputGestureText = MenuService.GetDisplayStringForShortcut(kg); } }
public MenuCheckBox(UIElement inputBindingOwner, Codon codon, object caller, IReadOnlyCollection <ICondition> conditions) : base(codon, caller, conditions) { this.Command = CommandWrapper.CreateCommand(codon, conditions); this.CommandParameter = caller; cmd = CommandWrapper.Unwrap(this.Command) as ICheckableMenuCommand; if (cmd != null) { isCheckedChangedHandler = cmd_IsCheckedChanged; cmd.IsCheckedChanged += isCheckedChangedHandler; this.IsChecked = cmd.IsChecked(caller); } if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); MenuCommand.AddGestureToInputBindingOwner(inputBindingOwner, kg, this.Command, null); this.InputGestureText = MenuService.GetDisplayStringForShortcut(kg); } }