I'm adding an option to a WPF Syntax Editor context menu. But the option appears disabled even after set the IsEnable property to true.
MenuItem menuItem = new MenuItem();
menuItem .Header = "New option";
menuItem .Command = new EditActionCommand("New option", new OptionImplementation());
menuItem .CommandTarget = textBox;
menuItem .IsEnabled = true;
menu.Items.Add(menuItem);
internal class OptionImplementation: EditActionBase
{
public override bool CanExecute(IEditorView view)
{
return true;
}
public override void Execute(IEditorView view)
{
// Implementation
}
}
I have another menu items added in the same way that are enabled. What I'm missing? Thank you.