Hi,
I'm trying to drag a radtreeview node into a radtextbox. I just want the information stored in the node "ToolTipText" to be displayed in the radtextbox.I did the following:
1. Set radtreeview AllowDragDrop to true
2. Set readtxtbox AllowDrop to true
3. In order to block radtreeview nodes to be moved in the tree I implemented a "DragEnding" event:
I'm trying to drag a radtreeview node into a radtextbox. I just want the information stored in the node "ToolTipText" to be displayed in the radtextbox.I did the following:
1. Set radtreeview AllowDragDrop to true
2. Set readtxtbox AllowDrop to true
3. In order to block radtreeview nodes to be moved in the tree I implemented a "DragEnding" event:
private void treeview_DragEnding(object sender, Telerik.WinControls.UI.RadTreeViewDragCancelEventArgs e)
{
e.Cancel = true;
}
4. I also implemented a "ItemDrag":
private void treeview_ItemDrag(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
DoDragDrop(e.Node, DragDropEffects.Copy);
}
5. In the radtextbox I implementeded the following "DragEnter" event:
private void textbox_DragEnter(object sender, DragEventArgs e)
{
IDataObject dataObject = e.Data;
if (dataObject == null)
e.Effect = DragDropEffects.None;
else
{
Telerik.WinControls.UI.RadTreeNode Node = dataObject.GetData(typeof(Telerik.WinControls.UI.RadTreeNode)) as Telerik.WinControls.UI.RadTreeNode;
if (Node != null)
e.Effect = e.AllowedEffect;
else
e.Effect = DragDropEffects.None;
}
}
6. I also implemented the "DragDrop"event for the textbox:
private
void
textbox_DragDrop(
object
sender, DragEventArgs e)
{
IDataObject dataObject = e.Data;
if
(dataObject !=
null
)
{
Telerik.WinControls.UI.RadTreeNode Node = dataObject.GetData(
typeof
(Telerik.WinControls.UI.RadTreeNode))
as
Telerik.WinControls.UI.RadTreeNode;
if
(Node !=
null
)
textbox.Text = textbox.Text.Insert(textbox.SelectionStart,
"Ok"
);
}
}
the problem is that the opration is not working. When I move a node over the radtextbox the program frozes. I used the VS "debug | break all" menu option and the stack has a lot of "_ItemDrag" event calls.
Any ideas?
Thanks,
Francisco