J
jmDesktop
I have searched everywhere and tried several things. I have a
treeview with and want to be able to only select a parent node. For
example:
root //don't want to drag this
-parent1 //yes, drag this an only this because it is a parent
--childOfParent1 //cannot drag this, only the parent
--childOfParent1 //can only drag parent
-parent2 //yes, parent, can select and drag
--childOfParent2 //no, cannot drag
....
I have tried various, but this was the last:
private void trvPapers_ItemDrag(object sender, ItemDragEventArgs
e)
{
TreeNode sourceNode = (TreeNode)e.Item;
if (sourceNode.Parent != null &&
sourceNode.Parent.IsSelected)
DoDragDrop(e.Item, DragDropEffects.Move);
}
fails. I don't get an error, just strange behavior and it doesn't do
what it's supposed to. Any help is appreciated. How can I only drag
parents along with their children? I don't want the user to drag the
children anywhere alone. I only want the parent and children to go
together. FWIW, my drag and drop works, I just can't limit it. Thank
you.
treeview with and want to be able to only select a parent node. For
example:
root //don't want to drag this
-parent1 //yes, drag this an only this because it is a parent
--childOfParent1 //cannot drag this, only the parent
--childOfParent1 //can only drag parent
-parent2 //yes, parent, can select and drag
--childOfParent2 //no, cannot drag
....
I have tried various, but this was the last:
private void trvPapers_ItemDrag(object sender, ItemDragEventArgs
e)
{
TreeNode sourceNode = (TreeNode)e.Item;
if (sourceNode.Parent != null &&
sourceNode.Parent.IsSelected)
DoDragDrop(e.Item, DragDropEffects.Move);
}
fails. I don't get an error, just strange behavior and it doesn't do
what it's supposed to. Any help is appreciated. How can I only drag
parents along with their children? I don't want the user to drag the
children anywhere alone. I only want the parent and children to go
together. FWIW, my drag and drop works, I just can't limit it. Thank
you.