yntaxEditor context menu option disabled

SyntaxEditor for WPF Forum

Posted 4 years ago by Daniel
Version: 16.1.0630
Avatar

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.

Comments (1)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

It's hard to say without debugging it.  Nothing stands out immediately as wrong there.  All our default menu items are built like this:

contextMenu.Items.Add(new MenuItem() { Header = SR.GetString(SRName.UIMenuItemUndoText), Command = EditorCommands.Undo, CommandTarget = this });

If you'd like us to look into it further, please make a new simple sample project that shows the issue and email it to our support address.  Reference this thread in your email and rename the .zip file extension of what you send so it doesn't get spam blocked.  Thanks!


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.