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?
sourceRow.Band.Layout.Grid
Yes, tried it immediately and it works!For the sake of completion, here it is:
UltraGrid sourceGrid = sourceRow.Band.Layout.Grid as UltraGrid;
Thank you!