Hello guys, I hope you are doing great.
I'm working on a WinForms project. One of the requirements is to drag files from the Desktop (or Windows Explorer) and drop them on a RadListView component.
I set the AllowDrop and AllowDragDrop properties of the my listView object, and then I added the following events:
When I drag an item from the Desktop and enter the listView area, I get the "DragEnter" message. If I comment that code out, and then drop an item on the listView, I don't get the "DragDrop" message.
My first question is: is it possible to achieve what I'm trying to do? And if it is possible, my second question is: what am I doing wrong?
I created a small test project to isolate the situation. The following is the complete code of the form class:
I'm also attaching an example of how the form looks like. The big white square is the list view which I want to drop the items to.
Thanks in advance.
Best regards,
Alejandro
I'm working on a WinForms project. One of the requirements is to drag files from the Desktop (or Windows Explorer) and drop them on a RadListView component.
I set the AllowDrop and AllowDragDrop properties of the my listView object, and then I added the following events:
private
void
listView_DragEnter(
object
sender, DragEventArgs e)
{
MessageBox.Show(
"DragEnter"
);
}
private
void
listView_DragDrop(
object
sender, DragEventArgs e)
{
MessageBox.Show(
"DragDrop"
);
}
When I drag an item from the Desktop and enter the listView area, I get the "DragEnter" message. If I comment that code out, and then drop an item on the listView, I don't get the "DragDrop" message.
My first question is: is it possible to achieve what I'm trying to do? And if it is possible, my second question is: what am I doing wrong?
I created a small test project to isolate the situation. The following is the complete code of the form class:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls;
namespace
DragFromDesktop
{
public
partial
class
DragFromDesktopForm : Telerik.WinControls.UI.RadForm
{
public
DragFromDesktopForm()
{
InitializeComponent();
}
private
void
DragFromDesktopForm_Load(
object
sender, EventArgs e)
{
}
private
void
closeButton_Click(
object
sender, EventArgs e)
{
this
.Close();
}
private
void
listView_DragEnter(
object
sender, DragEventArgs e)
{
//MessageBox.Show("DragEnter");
}
private
void
listView_DragDrop(
object
sender, DragEventArgs e)
{
MessageBox.Show(
"DragDrop"
);
}
}
}
I'm also attaching an example of how the form looks like. The big white square is the list view which I want to drop the items to.
Thanks in advance.
Best regards,
Alejandro