View previous topic :: View next topic |
Author |
Message |
keesp Guest
|
Posted: Mon Jun 06, 2005 11:37 am Post subject: checking valid drop options in virtual tree |
|
|
Hi there,
I am trying to check whether a dragged object can be inserted in-between rows by performing a check in the onDragOver event:
private void MyClass_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy; //is more complex of course
return;
}
However, the tree does not allow insertion, only beyond the last row (which appears to be the default behaviour)
How can I implement dropping dat in-between rows?
Thanx,
Kees |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jun 06, 2005 10:40 pm Post subject: |
|
|
What type of object are you trying to drop? Are you using ObjectBinding or DatasetBinding? If you are then you would normally set the AllowDropOn, AllowDropAbove and AllowDropBelow properties of the appropriate row bindings to control this and the AllowDrag property of rows that you want to be able to drag.
You can also handle this programmatically by handling the events (or their corresponding methods):
GetAllowRowDrag
GetAllowedRowDropLocations
GetRowDropEffect
RowDrop
The online documentation on "Drag and Drop" (under "Task Based Help" section) provides more information. _________________ Infralution Support |
|
Back to top |
|
|
keesp Guest
|
Posted: Tue Jun 07, 2005 7:38 am Post subject: drag & drop |
|
|
Hi,
I've tried to follow the advice on the help area, but the drag & drop events don't seem to get spawned.
What I try to do is drag a TreeNode from another control onto the virtual tree and then, prior to dropping the dragobject, chaeck whether it is allowed to be dropped at that specific location. The mechanism I use is default .NET drag&drop behaviour, so I use the DragOver event to perform a check that sets the DragDropEffect. I have also tried to use the Virtual Tree specific events to achieve the same (like rowdrop etc.), but they don't seem to get activated
In the ( derived class of the) virtual tree I have done:
this.AllowDrop = true;
this.EnableDragSelect = false;
In the rowbinding I have set AllowDropOn = true;
with this, I would expect to be able override some event where I can set the appropriate DragDropEffect, based on the rules I implement there. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Jun 07, 2005 11:21 am Post subject: |
|
|
Is the tree control you are dragging from also a VirtualTree? By default the rowbindings only support dragging within the same tree. You'd need to handle the drop event/methods programmatically if you want to drop between two trees.
This stuff is pretty hard to analyse without some code - if you can forward us a zipped sample project to support@infralution.com, which illustrates what you are trying to do that would help a lot.
Have you had a play with the ADO.NET Dataset Browser sample? This uses standard drag and drop using RowBindings. _________________ Infralution Support |
|
Back to top |
|
|
|