Hello. I have a function on double click which opens new form. The problem is if I double click arrow on grid's scroll bar, or if I double click scroll bar, it activate that function. I want this form to open just on double click empty area. Is there any solution for this ?
Are you trying to open a new form when the user double clicks a cell or row? If so, you could use the DoubleClickCell event of the UltraGrid to process the request. Using the DoubleClick event of the control would mean that anywhere you double click on the UltraGrid will fire that event.
I also have function for DoubleClickRow, but I wanted to make funcionality like MS Outlok has, when user click on empty space in table, opens a new contact form. But if it fires event if I click anywhere on grid, I'll just delete this function, and use context menu on right click to add new contact. Thanks on your answer...
Is it possible to get the UltraGridRow that's next to this blank space?
-------------
Nevermind. I found the UIElementViewer and I was able to figure it out.
Thanks Mike, that do the trick. Here is the code I used...
UIElement element = grid1.DisplayLayout.UIElement.LastElementEntered; RowColRegionIntersectionUIElement blankSpace = element as RowColRegionIntersectionUIElement; if (blankSpace == null) { blankSpace = element.GetAncestor(typeof(RowColRegionIntersectionUIElement)) as RowColRegionIntersectionUIElement; if (blankSpace == null) return; }
You could use the DoubleClick event, but you would have to use the grid's UIElements to determine what part of the grid the mouse is over.
If you have not used UIElements before, this can be a bit tricky. But basically, you would examine grid.DisplayLayout.UIElement.LastElementEntered.
You would then check to see if that element is a RowColRegionIntersectionUIElement. This is the element that basically represents the blank space outside of the rows and columns.