I have a contextMenu in a c# Windows forms program that handles calls from a few grids and I wonder how to refer to select rows generically. Should I be able to cast the sending control as an UltraWinGrid as attempted below? Or is there maybe a better way? Thanks for suggestions.
private void myMenu(object sender, System.EventArgs e) {
foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in Infragistics.Win.UltraWinGrid(sender)) {
Assuming that the 'myMenu' handler is handling the MenuItem's Click event, the sender will not be the grid, it will be the MenuItem itself. One approach to solving this problem would be to assign a reference to the UltraGrid to the ContextMenu's Tag property, then (in the MenuItem's Click event handler) use the MenuItem's GetContextMenu method to get the owning ContentMenu. Once you have that you can cast the value of the Tag property to type UltraGrid, and you will then have a reference to the owning control.