public ToolBarButton(UIElement inputBindingOwner, Codon codon, object caller, IReadOnlyCollection <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; Command = CommandWrapper.CreateLazyCommand(codon, conditions); CommandParameter = caller; Content = ToolBarService.CreateToolBarItemContent(codon); this.conditions = conditions; if (codon.Properties.Contains("name")) { Name = codon.Properties["name"]; } if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); MenuCommand.AddGestureToInputBindingOwner(inputBindingOwner, kg, Command, GetFeatureName()); inputGestureText = MenuService.GetDisplayStringForShortcut(kg); } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.ButtonStyleKey); }
public ToolBarCheckBox(Codon codon, object caller, IReadOnlyCollection <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.conditions = conditions; Command = CommandWrapper.CreateCommand(codon, conditions); CommandParameter = caller; var cmd = CommandWrapper.Unwrap(Command) as ICheckableMenuCommand; if (cmd != null) { isCheckedBinding = SetBinding(IsCheckedProperty, new Binding("IsChecked") { Source = cmd, Mode = BindingMode.OneWay }); } Content = ToolBarService.CreateToolBarItemContent(codon); if (codon.Properties.Contains("name")) { Name = codon.Properties["name"]; } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.CheckBoxStyleKey); }
public void UpdateText() { if (codon.Properties.Contains("tooltip")) { ToolTip = StringParser.Parse(codon.Properties["tooltip"]); } if (codon.Properties.Contains("label")) { Content = ToolBarService.CreateToolBarItemContent(codon); } }
public ToolBarDropDownButton(Codon codon, object caller, IList subMenu, IEnumerable <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.conditions = conditions; Content = ToolBarService.CreateToolBarItemContent(codon); if (codon.Properties.Contains("name")) { Name = codon.Properties["name"]; } DropDownMenu = MenuService.CreateContextMenu(subMenu); UpdateText(); }
public ToolBarSplitButton(Codon codon, object caller, IList submenu, IReadOnlyCollection <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.conditions = conditions; Content = ToolBarService.CreateToolBarItemContent(codon); if (codon.Properties.Contains("name")) { Name = codon.Properties["name"]; } Command = CommandWrapper.CreateLazyCommand(codon, conditions); CommandParameter = caller; DropDownMenu = MenuService.CreateContextMenu(submenu); UpdateText(); }