Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public void UpdateText()
 {
     if (codon.Properties.Contains("tooltip"))
     {
         ToolTip = StringParser.Parse(codon.Properties["tooltip"]);
     }
     if (codon.Properties.Contains("label"))
     {
         Content = ToolBarService.CreateToolBarItemContent(codon);
     }
 }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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();
        }