I have a three grids that all allow a drag and drop (x, y and z) between the three of them. I want to allow a drag and drop between any two grid, disallowing a D&D from a grid onto its self. Most of the time there are no issues with this process. However once in a while I get a issue.
In order to verify that the drag drop is not being performed from and to the same grid I do the following:
DragRows = CType(e.Data.GetData("Infragistics.Win.UltraWinGrid.SelectedRowsCollection"), UltraWinGrid.SelectedRowsCollection)If DragRows(0).GetUIElement.Control Is sender then Exit sub
It seems when a large number of rows are selected, occasionally DragRows(0).GetUIElement will have a value of nothing. In this instance DragRows.Count will return the correct amount of rows, but I will not be able to verify if the sender is the same as the receiver.
I can find no particular reason for this to happen, it seems very random and difficult to reproduce. Is there a better way to check if a D&D sender is not the receiver of the action? Thank you in advanced.
Perfect, thank you!
Hi,
This makes perfect sense. The UIElement is the element that is used to draw the row on the screen. If the row is not on the screen, the UIElement will be null. So you must be selecting rows in such a way that the first selected row is no longer on the screen and visible and therefore the UIElement is null.
So using UIElements here is not the way to go.
Instead, you can get the control by using something like this: DragRows(0).Band.Layout.Grid