Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
620
How to get parent UltraGrid from just a UltraGridRow
posted

Is there a way of getting a reference to the UltraGrid to which an UltraGridRow belongs?

Here's what I am doing: I have a pre-existing ultraGrid_DragDrop event-handling delegate.

All grids use the same delegate because they all do the same thing.

But I must now add code to prevent a drag-drop operation ON THE SAME GRID. Different grid is OK.

I am trying to do this by comparing the dropGrid to the sourceGrid and making sure they are not the same.

Here's how far I got:

I get the drop grid from the sender object.

UltraGrid dropGrid = sender as UltraGrid;

And I have a sourceRow from the source grid by using the DragEventArgs e.

SelectedRowsCollection sourceRows = e.Data.GetData(typeof(SelectedRowsCollection)) as SelectedRowsCollection;

I know there is at least one row inside the collection, so:

UltraGridRow sourceRow = sourceRows[0];

But how do I now get the sourceGrid from the sourceRow? Is there a way?