Hi All
How are you doing.. I hope everybody is doing great. Here I have a requirement that I need to add context menu to the UltraWinGrid.. Can anybody help me with that.Like how to add a context menu to the UltraWinGrid and items to that menu and How to write click events for them.
Basically I need to add two items to the context menu for the grid rows and then if the user clicks on them I need to do some functionality.
If anybody could help in gudiing me through this.. it would be really helpful.
Well, that sucks... Especially taking into consideration that the grid’s ContextMenuStrip is essentially useless for all practical purposes.
But thanks anyway!
The menu you are referring to is not just similar to the one on the inbox TextBox control - it's the same menu. When the grid cell enters edit mode, it displays a TextBox control over the cell to allow you to edit. So it's actually a TextBox and the TextBox's ContextMenu that you are seeing.
There is no way to access or modify this menu. The only thing you can do is replace it by setting a ContextMenuStrip on the grid.
Mike, sorry for a slight off-topic, but the standard cell editor (e.g. Infragistics.Win.EditorWithText) has a default ContextMenuStrip (that already has Cut/Copy/Paste functionality + bunch of other stuff). It's the same ContextMenu that pops up by default on right-click on a regular UltraTextEditor control and so on. Where is it defined? How can I get a reference to the instance of that ContextMenu to alter and reuse?
Hi,
UltraGrid grid = (UltraGrid)sender; UIElement element = grid.DisplayLayout.UIElement.LastElementEntered; if (element == null) return; UltraGridRow row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow; if (row == null) return; Debug.WriteLine(row.Index);
Mike,
Thanks for your help. I was able to assciate a context menu to the infragistics grid. But I am not a VB guy. So can you please help me with how to get the selected row in c#.