Drag Drop (from external source) not working in NTreeList


Author
Message
Partho Sarathi
Partho Sarathi
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 9, Visits: 1
I am using the following code to handle a drag drop of a windows explorer file.


public Form1()
{
InitializeComponent();

treeList.AllowDrop = true;
treeList.DragEnter += treeList_DragEnter;
treeList.DragDrop += treeList_DragDrop;
}

private void treeList_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
{
FileInfo info = new FileInfo(file);
treeList.Nodes.Add(new NTreeListNode
{
SubItems =
{
new NTreeListNodeStringSubItem(info.Name)
{Column = treeList.Columns["Name"]},
new NTreeListNodeStringSubItem(info.Length.ToString())
{Column = treeList.Columns["Size"]}
}
});
}
}

private void treeList_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}


Dragging files to the NTreeList control does not show the Copy cursor, even though the DragEnter handler is called. The DragDrop handler is not called.

Similar code works for Microsoft's ListView.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search