public ToolBarButton(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand, IEnumerable <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.Command = CommandWrapper.GetCommand(codon, caller, createCommand, conditions); 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 = kg.GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.ButtonStyleKey); }
public MenuCheckBox(UIElement inputBindingOwner, Codon codon, object caller, IEnumerable <ICondition> conditions) : base(codon, caller, conditions) { this.Command = CommandWrapper.GetCommand(codon, caller, true, conditions); CommandWrapper wrapper = this.Command as CommandWrapper; if (wrapper != null) { ICheckableMenuCommand cmd = wrapper.GetAddInCommand() as ICheckableMenuCommand; if (cmd != null) { isCheckedBinding = SetBinding(IsCheckedProperty, new Binding("IsChecked") { Source = cmd, Mode = BindingMode.OneWay }); } } if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); MenuCommand.AddGestureToInputBindingOwner(inputBindingOwner, kg, this.Command, null); this.InputGestureText = kg.GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); } }
public ToolBarCheckBox(Codon codon, object caller, IEnumerable <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.conditions = conditions; this.Command = CommandWrapper.GetCommand(codon, caller, true, conditions); CommandWrapper wrapper = this.Command as CommandWrapper; if (wrapper != null) { ICheckableMenuCommand cmd = wrapper.GetAddInCommand() as ICheckableMenuCommand; if (cmd != null) { isCheckedBinding = SetBinding(IsCheckedProperty, new Binding("IsChecked") { Source = cmd, Mode = BindingMode.OneWay }); } } this.Content = ToolBarService.CreateToolBarItemContent(codon); if (codon.Properties.Contains("name")) { this.Name = codon.Properties["name"]; } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.CheckBoxStyleKey); }
public MenuCommand(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand, string activationMethod) : base(codon, caller) { this.ActivationMethod = activationMethod; this.Command = CommandWrapper.GetCommand(codon, caller, createCommand); if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); AddGestureToInputBindingOwner(inputBindingOwner, kg, this.Command, GetFeatureName()); this.InputGestureText = kg.GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); } }