I am having a context menu displayed when i right click on a node of a treeview. Suppose my treeview is as follows
Root
|->some.txt
|-> Child(For some.txt)
|-> Child1(child for Child)
If i right click on Child1 i will have an option as AddNew. If the user selects i will show a user control form for the user displayed in a panel.
What i need is if the user selects the option as Child1 and if the user control is active and when the user again right clicks on Child1 i would like to make the context menu as non-selectable field. Can any ine tell how to do.
Any modifications as to the selectability of ContextMenu Items depending on a scenario can be done in the Opening event of the ContextMenu.
• Make sure you have a way of determining whether the usercontrol is visible (flag, Visibility, check for != null…whatever is appropriate in your situation)
• define an opening handler for your contextmenu
• in the opening handler, check if control is visible (see point 1)
• if so, set the menu item’s enabled status to false, otherwise to true.
HTH