I have a treeview where I have enabled 'AllowDragDrop' and 'AllowDrop'. However, the 'ItemDrag', 'DragStarted' and 'DragStarting' events aren't firing all all.
Is there something I'm doing wrong? The documentation makes it look easy!
I'm basically wanting to detect when a node from the first treeview is dragged into the second treeview.
Thanks,
Richard.
9 Answers, 1 is accepted
I did not manage to reproduce the issue with the supplied information. Could you share with us the code snippets that demonstrate how you initialize the RadTreeView control? Notice that drag and drop operation does not work in bound mode.
Greetings,Svett
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
There's no way I can modify my app to use unbound data, it's way too much rearchitecture to get around a missing feature in a control.
ps - you should flag this page in the help file to inform that currently drag drop isn't supported in bound mode. I'm sure that will save developers many hours of frustrated digging!
ms-help://TelerikWinForms.2011.2.0/TelerikWinForms.2011.2.0/html/681684F3-010F-4A92-856A-7E792BBB40E2.htm
Thanks,
Richard.
Presently, RadGridView does not support drag and drop in bound mode. We will consider implementing this feature in one of the next releases. In the meantime, the only way to allow drag and drop is by using the RadGridView in unbound mode.
Thank you for your feedback.
We will improve the documentation mentioning that the drag and drop operation is available only in the unbound mode.
Svett
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
You mentioned RadGridView in your post which I'm assuming is a typo, but just to be 100% clear, are you saying that RadTREEView does not support drag/drop in bound mode? If not, then yes - getting support for that would be fantastic (I can't believe other people haven't been asking for it already - drag and drop is a fairly fundamental use inside a treeview controls).
I wouldn't even need anything complicated, just a notification that Node X has been drag/dropped onto Y. Then I could handle all the plumbing code myself. Right now using unbound Treeviews is not going to happen in my application - way too much refactoring to do so...
I confirm that at this time, RadTreeView does not support drag and drop in bound mode. This is something that we should make available for our customers in one of the next major releases. In the meantime, you can use this feature only in unbound mode.
Nevertheless, you can replace the default drag and drop behavior by creating a custom TreeViewDragDropService:
public
class
RTreeView : RadTreeView
{
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadTreeView).FullName;
}
set
{
base
.ThemeClassName = value;
}
}
protected
override
RadTreeViewElement CreateTreeViewElement()
{
return
new
RTreeViewElement();
}
}
public
class
RTreeViewElement : RadTreeViewElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(RadTreeViewElement);
}
}
protected
override
TreeViewDragDropService CreateDragDropService()
{
return
new
RTreeViewDragDropService(
this
);
}
}
public
class
RTreeViewDragDropService : TreeViewDragDropService
{
public
RTreeViewDragDropService(RadTreeViewElement treeView)
:
base
(treeView)
{
}
protected
override
bool
CanStart(
object
context)
{
return
context
is
TreeNodeElement;
}
protected
override
void
OnPreviewDragDrop(Telerik.WinControls.RadDropEventArgs e)
{
// TO DO: Your drag and drop logic here
}
}
Notice that you should override the OnPreviewDraDrop method where you can place your drag and drop logic. Best wishes,
Svett
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
I'm running into the same problem. I have a databound treeview (self referencing) and need to add drag and drop functionality.
Is there an ETA on enabling this feature or somewhere we can Vote for it?
Thanks,
Brad
This feature is not addressed yet. Nevertheless, you can vote for this feature via our public issue tracking system here.
Best wishes,Svett
the Telerik team
This code you posted doesn't compile in my project. It seems that objects: RadTreeViewElement, TreeNodeElement, TreeViewDragDropService don't exist in Web dlls that I downloaded recently, version 2011.2.915.40. so how should i get them to work in a web application
help me out with this, i'm trying to override the drag and drop functionality for bound tree.
There is no such version (2011.2 915.40) of RadControls for Winforms. Are you using RadControls for ASP.NET AJAX? If so, please post your questions in the appropriate forum section as this section concerns RadTreeView for WinForms only.
Thank you for your understanding.
Svett
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.