Enable and Disable Contextual MenuItems

I am trying to Programmically enable or disable Contextual MenuItem Such as

Created under the ConstructContextualMenu Event.
base.Append(New MenuItem(“Crop”))

i would later in the app Disable this or Re-Enable this.
I have tried MenuItem.Item(0).Enabled = False. But this does not work, it gives a class instance error.

You create a menu item in ConstructContextualMenu event which is not existing anymore after the event ends. You cannot manipulate it from somewhere else. This will work:

Dim item As New MenuItem("Crop") item.Enabled = False base.Append(item)

Or you create the item somewhere else and hold a reference to it the whole time – for example in a window or a canvas subclass:

[code]Property mItem As MenuItem

Public Sub Constructor()
Super.Constructor()
mItem = New MenuItem(“Crop”)
mItem.Enabled = False
End

Event Resized() // This is just an example to change Enabled from True to False to True etc.
mItem.Enabled = Not mItem.Enabled
End

Event ConstructContextualMenu(base As MenuItem, x As Integer, y As Integer) As Boolean
base.Append(mItem)

End Function[/code]

Hi Eli
Ok great thank you sir.