Where can I download a tutorial or C # example that explains the use of Drag and Drop between two UltraGrid?
I found sample projects that explain the use of drag and drop into the UltraGrid component itself. But I have not found any that explain how to do it from one datagrid component to another one.
Thanks in advance!
Don't worry about this. I found out right after I posted the question. For those who want to know, I did this inside DragDrop event:
Dim SelRows As SelectedRowsCollection = TryCast(DirectCast(e.Data.GetData(GetType(SelectedRowsCollection)), SelectedRowsCollection), SelectedRowsCollection)
If TypeOf SelRows(0).ListObject Is YourTypeHere Then ....
Can you let us know how to find out the underlying datatype of the datasource bound to the dragged rows? I want to check to make sure that only records dragged from certain source is acceptable for certain destination grid. I'm using custom data source so the band.key comes out to be List which is not enough. Is there a way to get to the datasource?
The code you have here seems to work fine for me. The most common reason for the UIElement to be null here is that people do not realize that the coordinates you get inside the DragDrop event are screen coords instead of client coords. But you are handling that part correctly.
Personally, I would use e.X and e.Y to get the point, rather than using Control.MousePosition, but unless there's some sort of timing issue happening here, they will usually be the same.
My advice is to put in some Debug.Writeline statements right before you call ElementFromPoint and display the grid's ClientRectangle and the client point you are using and make sure the point is inside the bounds.
Debug.WriteLine(clientPoint, grid.ClientRectangle.ToString())
i dont have an answer at this moment, but i will attempt to determine what the issue is when i get some time later this week.
I am doing the drag and drop between two grids, but I want to modify the row I am dropping on. The code I am trying to use is shows below. The Problem is, I am always returning a nothing element
Can anybody tell me what i am doing wrong? I am dragging from another grid to this one (UGUsed)
Thanks
Private Sub UGUsed_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles UGUsed.DragDrop
UIElement = UGUsed.DisplayLayout.UIElement
clientPoint = .PointToClient(screenPoint)
' Get the element at that point
element = mainElement.ElementFromPoint(clientPoint)
etc