Home › Forums › WPF controls › Xceed DataGrid for WPF › Drag and Drop operation.
I’m trying to setup a drag and drop but it doesn’t work !
Private Sub LeftGrid_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Input.MouseEventArgs) Handles LeftGrid.MouseMove If e.LeftButton Then
Try Dim draggedfile As String
draggedfile = LeftGrid.SelectedItem(0)
Dim d As DataObject = New DataObject(DataFormats.Text, draggedfile) Dim fx As DragDropEffects = DragDrop.DoDragDrop(e.Source, d, DragDropEffects.All)
Catch ex As Exception
I used to make it work under Windows.Forms but now i don’t …
Do you have any idea ? 😀
Imported from legacy forums. Posted by Aybe (had 615 views)
Alright, after went crazy, here’s the solution !
For some reasons, even when retrieving one string from the Grid, it always passes it as an Array of Strings.
Declare the result string as an array of strings and not only a single string,
If e.LeftButton = MouseButtonState.Pressed Then
Dim result(0) As String result(0) = LeftGrid.SelectedItem(6)
Dim d As DataObject = New DataObject(DataFormats.FileDrop, result, True) Dim fx As DragDropEffects = DragDrop.DoDragDrop(LeftGrid, d, DragDropEffects.Copy)
It’s a quick & dirty fix, but working 😀
Imported from legacy forums. Posted by Aybe (had 2971 views)