Repro-steps:
Observed behavior:
Expected behavior:
Hello Martin,
You have a point here. After a brief discussion with the development team regarding your scenario, we can agree that this behavior could be improved. It is not expected for the target node to expand when the drag-drop operation is canceled. Therefore I have changed the status of the feedback item. As a workaround, you may consider using the NodeExpandedChanging event handler to cancel the expand operation.
Your account has been credited with Telerik Points as a token of appreciation for bringing this to our attention.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Supplement:
Maybe this point should not be viewed from a technical point of view, but a more functional point of view:
With other words: Why is this by design?
Hi Dinko,
I disagree or I misunderstand.
As far as I understand it, when you drag a node over another node, it is automatically expanded AFTER ExpandTimerInterval has elapsed. That is way I said in step 2: "Set the TreeViewElement.ExpandTimerInterval to forever". So this should disable the auto-expand behavior.
In this case, the auto expand is not trigger by the timer of by hovering over the node. In this case the auto expand is trigger by the drop. And I can imagine that when a node is dropped on another node, it is automatically expanded, but in my case, the drop is cancelled. So no need to expand.
Hello Martin,
This is the default behavior. When a dragged node is dragged over a collapsed node, it will automatically expand. To suppress this, you can subscribe to the NodeExpandedChanging event and cancel the node expanding. You can raise a flag in the DragEnding event handler. Check the following code snippet. You can also check the last section in the Cancel a Drag and Drop Operation help article.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.radTreeView1.TreeViewElement.ExpandTimerInterval = 5000;
this.radTreeView1.DragEnding += RadTreeView1_DragEnding;
this.radTreeView1.NodeExpandedChanging += RadTreeView1_NodeExpandedChanging;
}
private void RadTreeView1_NodeExpandedChanging(object sender, Telerik.WinControls.UI.RadTreeViewCancelEventArgs e)
{
Debug.WriteLine(radTreeView1.TreeViewElement.DragDropService.State);
e.Cancel = cancelExpand;
}
bool cancelExpand = false;
private void RadTreeView1_DragEnding(object sender, Telerik.WinControls.UI.RadTreeViewDragCancelEventArgs e)
{
e.Cancel = cancelExpand = true;
}
}
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.