Hi,
Suppose we have ContextMenuStrip defined for the UltraGrid. There are 3 menuitems(menu1, menu2, menu3) in ContextMenuStrip.
In .Open event of ContextStripMenu we make Visible property of all 3 buttons False. Then on First right click of mouse we see a narrow line.
Can you please suggest how to overcome it? I don't want to see anything if for all items in menustrip Visible = False.
Hello Nitin,
All items in the ContextMenuStrip are with property visible to false in Opening event, and only handling of this event you could prevent context menu of showing, so you should put there the logic which will check if any of the ContextMenuItems should be displayed to the customer (based on your custom criteria similar to this one, that you have implemented in Opened event) in order to cancel the event.
If you need any further assistance or I am missing something, please let me know.
Hi Ivaylo,
I went through your solution. I find that in .Open event of Ultragrid the value we get for toolstripmenuitem.Visible does not show the real value.
It is always showing value as false irrespective of setting it to true. If it showed the real values then I can check it and cancel the event. But, since it is not happening, the event will always be cancelled.
Thanks,
Nitin
Hello Nitin,Thank you for contacting Infragistics!Please see the sample I am sending you attached to this email. In the handler of ContextMenuStrip Opening Event I am checking if all items in the ContextMenuStrip are equal to false, then the event is being canceled.This is one of the ways to prevent the rendering of empty ContextMenuStrip and its narrow line.I am looking forward for your answer.