How to get a drop-down list of actions after pressing a checkbox?

Hi,

I was trying to code a ComboEditorTool to get a list of actions, but I want to get it after pressing a checkbox. I ran into a problem because I can call the list but only after selecting an object in the 3D world(If I press the checkbox and I don’t select any component in the 3D World, the action is not executed, that means another problem which is always that I select another component the action is executed). My question is, there is a method to execute this action just after pressing the checkbox.

Thank you beforehand for your help.

I will leave the example code that I am using and a print screen of the action.

[Export(typeof(IActionItem))]
    public class PMcommand : ActionItem, IHandle<ItemSelectedMessage<ISimComponent>>
    {
        
        [ImportingConstructor]
        public PMcommand([Import(typeof(IEventAggregator))] IEventAggregator EAgregator)
            : base("PMCommandId", " PM command ", "", null, MenuTools.ComboEditorTool)
        {
            canExecuteAction = CanBeExecuted;
            EAgregator.Subscribe(this);

        }

        private bool CanBeExecuted()
        {

            if (PMCheckBox.isChecked)
            {
                return true;
            }
            return false;
        }

        public ObservableCollection<ComboItemBase> ComboItems { get; set; }
                       
        public void Handle(ItemSelectedMessage<ISimComponent> message)
        {
            EvaluateCanExecute();
            if (PMCheckBox.isChecked)
            {

                        ComboItems = new ObservableCollection<ComboItemBase>();
                        for (int i = 0; i < 5; i++)
                        {
                            
                            ComboItemBase item = new ComboItemBase()
                            {
                                Parent = this,
                                Content = "test" + i,
                                Value = "layers" + i

                            };

                            ComboItems.Add(item);

                        }

                        NotifyOfPropertyChange(() => ComboItems);
                        if (selectedComboItem == null)
                        {
                            ComboItemBase currentSelection = ComboItems.FirstOrDefault();
                            selectedComboItem = currentSelection;
                        }
            }
            else if (PMCheckBox.isChecked != true)
            {
                ComboItems = null;
            }
        }

        public static ComboItemBase selectedComboItem;
        public ComboItemBase SelectedComboItem
        {
            get
            {
                return selectedComboItem;
            }
            set
            {
                selectedComboItem = value;
                NotifyOfPropertyChange(() => SelectedComboItem);
            }
        }
    }

    [Export(typeof(IActionItem))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    internal class PMCheckBox : ActionItem
    {
        [ImportingConstructor]
        public PMCheckBox([Import(typeof(IEventAggregator))] IEventAggregator EAgregator)
        : base("PMCheckBox", "PM checkbox", "", null, MenuTools.CheckBoxTool, true)
        {
            EAgregator.Subscribe(this);

        }

        public static bool isChecked;


        public bool IsChecked
        {
            get
            {
                return isChecked;
            }
            set
            {
                isChecked = value;
            }
        }
    }

In current implementation there is nothing notifying PMcommand action about the check box status change. You either to call PMcommand.EvaluateCanExecute() from PMCheckBox.IsChecked setter.

Alternatively you could publish a message or event from PMCheckBox.IsChecked setter, subscribe to event in PCCommand and call EvaluateCanExecute from the handler.