Posted 28 February 2021, 5:37 pm EST
- Updated 3 October 2022, 2:22 pm EST
You can use the DragDrop and DragOver event to achieve this. First, you need to set the DropMode property of the FlexGrid to DropModeEnum.Manual so that the grid fires the standard drag-drop events. Then you can handle the DragOver event and check if a File is being dragged using the GetData method of the IDataObject and then set the DragDropEffect accordingly. You can use the Data property of the DragEventArgs to get the IDataObject.
Now you can handle the DragDrop event to handle the dropping of data. You can use the GetData method of the IDataObject with DataFormats.FileDrop, it will return a string array containing the path of all the files being dropped. You can then use the FileInfo class to get all the data about the file using the provided file path and set the data according to your requirement in the cells. You can use the Hitest method of the flexgrid to know the cell on which the content was dropped. Please refer to the GIF and sample attached.