Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Drag and Drop Treeview Items between 2 Treeview

 
 
Old 02-23-2006   #1 (permalink)
ProjectGKR


 
 

Drag and Drop Treeview Items between 2 Treeview

Good Day

I am experiencing difficulties in doing a Drag Drop of TreeViewItems between
Treeviews.

Maybe just a brief explanation on how I go about populating the first
Treeview. What I do is in the code I add TreeViewItems that can be a
collection of multiple TreeViewItems. When I am Starting to do the Dragging
of a selected TreeViewItem, I make use of the following piece of code:
DragDrop.DoDragDrop(this, TreeView1.SelectedItem, DragDropEffects.Copy |
DragDropEffects.Move);

With a DragOver Event on the second treeview I ensure that what is being
dragged is a TreeViewItem, but when on the second treeview the mouse Cursor
shows that I am unable to drop the dragged Item onto the TreeView control. I
also made sure that the AllowDrop = true on the second Treeview.

I have tried the DragLeave on the second treeview but it doesn't seem to
fire correctly.

Am I correct in saying that the DragLeave event is raised when the user
drags the cursor out of the control or the user cancels the current
drag-and-drop operation and that the DragAction is Cancel when the DragLeave
event is raised.



I added a TextBox on the form with the 2 Treeviews and when I drag a
treeview item from the first treeview, the Drop event fires for the textbox
and the Data object that has been passed is actually the TreeViewItem that
is selected in the first Treeview. The Cursor when dragging the TreeViewItem
over the Textbox changes to indicate that I can drop the dragged item while
on the second treeview the cursor changes to indicate that I am unable to
drop the dragged Item.



On the second treeview there is to events I have:
1. DragOver
2. Drop

When I add a break point in the DragOver event and actually drag an item
from the first to the second treeview, and step the code once the break
point in the DragOver event is hit, the Drop Event is fired, but with out
the break point, the event is not fired and the cursor indicates that I can
not drop.

AllowDrop is set to true on the Second Treeview.

Any help would be appreciated.



My System SpecsSystem Spec
Old 02-24-2006   #2 (permalink)
agu


 
 

Re: Drag and Drop Treeview Items between 2 Treeview

Hi,

check out this blog, you may find what you're looking for...
http://blog.rioterdecker.net/blogs/a.../12/18/59.aspx

Rgds,
A.


My System SpecsSystem Spec
Old 02-24-2006   #3 (permalink)
Ifeanyi Echeruo [MSFT]


 
 

Re: Drag and Drop Treeview Items between 2 Treeview

The information on that post is not quite accurate. Here is a drag drop
sample that uses the platforms drag drop API.
http://blogs.msdn.com/marcelolr/arch...03/414490.aspx

-- Ifeanyi Echeruo [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.

"agu" <anthony.guerot[RemoveThis]@vcstimeless.fr> wrote in message
news:81a492342adf8c807847467e5bd@news.microsoft.com...
> Hi,
>
> check out this blog, you may find what you're looking for...
> http://blog.rioterdecker.net/blogs/a.../12/18/59.aspx
>
> Rgds,
> A.
>
>



My System SpecsSystem Spec
Old 03-14-2006   #4 (permalink)
ProjectGKR


 
 

Re: Drag and Drop Treeview Items between 2 Treeview

I upgraded from the Jan 2006 CTP to the Feb 2006 CTP and now the drag and
drop event is executing correctly. I can now drag a TreeViewItem from the
one TreeView to another TreeView in the Feb 2006 where I was unable to do
this in the Jan 2006 CTP.



"Ifeanyi Echeruo [MSFT]" <ifeanyie@online.microsoft.com> wrote in message
news:%23Gkbt2XOGHA.2668@tk2msftngp13.phx.gbl...
> The information on that post is not quite accurate. Here is a drag drop
> sample that uses the platforms drag drop API.
> http://blogs.msdn.com/marcelolr/arch...03/414490.aspx
>
> -- Ifeanyi Echeruo [MSFT]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> "agu" <anthony.guerot[RemoveThis]@vcstimeless.fr> wrote in message
> news:81a492342adf8c807847467e5bd@news.microsoft.com...
>> Hi,
>>
>> check out this blog, you may find what you're looking for...
>> http://blog.rioterdecker.net/blogs/a.../12/18/59.aspx
>>
>> Rgds,
>> A.
>>
>>

>
>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Need help on treeview VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46