Ticket Q501889
Visible to All Users

Add ability to drag and drop files from File/Windows Explorer to Grid control in Windows Form application

created 12 years ago

I have a Windows Forms application. One of the forms has a grid on it, in which I hope to display a list of filenames and descriptions (i.e. two columns of string data). I would like to allow the user to have the form open as well as a window for File/Windows Explorer, giving them the ability to select one or more files in the latter, and drag them to the grid. Then, when this happens, I would like to interrogate the dropped items to pull the file path and name. Is this possible to do using the grid control? If not, could it be done if I had another form in my application that basically functioned like File/Windows Explorer, thereby allowing the user to click and drag from one form to the grid on the other? Last, but not least, if neither of those options is possible, could I have another control on the same form with the grid (i.e. perhaps another grid or a treeview or something), and allow the user to drag and drop from that control to the grid?

Answers approved by DevExpress Support

created 12 years ago (modified 12 years ago)

Hi Bob,
This task is not directly related to XtraGrid and can be implemented manually. It is necessary to set the gridControl's AllowDrop property to true. Then, handle the gridControl's Drag~ events to determine which data is dragged to the grid and manage it as necessary. Please also refer to the How do I drag and drop files into a c# application? SO question.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.