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 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 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, 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); } }
public MenuCommand(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand) : base(codon, caller) { this.Command = new CommandWrapper(codon, caller, createCommand); if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); inputBindingOwner.InputBindings.Add( new InputBinding(this.Command, kg) ); this.InputGestureText = kg.GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); } }
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); } }