Drag and Drop

Discussions about document viewing.
Post Reply
dvonfeldt
Posts: 5
Joined: Mon Oct 01, 2012 9:11 pm

Drag and Drop

Post by dvonfeldt » Mon Oct 01, 2012 9:13 pm

Hello,

Do you have a sample of how to implement drag and drop with two thumbnail viewers? I would like to be able to move a tif page from one thumbnail viewer to another thumbnail viewer, but the DragDrop event does not want to fire.

Sample in VB.NET or C# please.

Thanks,

Dan

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Drag and Drop

Post by Loïc » Mon Oct 01, 2012 9:47 pm

Hello,

You will find C# & vb.NET samples in our latest package. Just search for "Thumbnail - Drag And Drop" demo project.

Let me know if you don't find it.

Regards,

Loïc

dvonfeldt
Posts: 5
Joined: Mon Oct 01, 2012 9:11 pm

Re: Drag and Drop

Post by dvonfeldt » Mon Oct 01, 2012 10:27 pm

I'm not seeing it. I'm looking in C:\Program Files (x86)\GdPicture.NET 9\samples\AnyCPU ??
Should I be looking somewhere else?

dvonfeldt
Posts: 5
Joined: Mon Oct 01, 2012 9:11 pm

Re: Drag and Drop

Post by dvonfeldt » Mon Oct 01, 2012 10:40 pm

Nevermind. Got it, I had an earlier version. Thanks!

dvonfeldt
Posts: 5
Joined: Mon Oct 01, 2012 9:11 pm

Re: Drag and Drop

Post by dvonfeldt » Tue Oct 02, 2012 7:01 pm

Hello,

Couple questions:

1) How can I get the DragDrop event to fire when the OwnDrop property is set to false. The autoscrolling stops working when OwnDrop is true.
2) Is there functionality with the thumbnail viewer to show the user where the thumbnail will be dropped? I.E. when they hover ahead or behind an image a line could appear indicating that is where the image will be placed.

Thanks,

Dan
Last edited by dvonfeldt on Thu Oct 04, 2012 12:32 am, edited 1 time in total.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Drag and Drop

Post by Loïc » Tue Oct 02, 2012 9:20 pm

Hello,
1) How can I get the DragDrop event to fire when the OwnDrop property is set to false. The autoscrolling stops working when OwnDrop is false.
This is not possible. When OwnDrop property is set to false, DragDrog is never fired for internal usage. That said, I don't understand what you meant by "autoscrolling stops working when ", could you clarify?
2) Is there functionality with the thumbnail viewer to show the user where the thumbnail will be dropped?
Unfortunately not yet. The appearance should be improved in future release.

Kind regards,

Loïc

dvonfeldt
Posts: 5
Joined: Mon Oct 01, 2012 9:11 pm

Re: Drag and Drop

Post by dvonfeldt » Tue Oct 02, 2012 9:30 pm

Thank you for the reply. What I mean by auto scrolling is the following: If I have a large amount of images in a thumbnail viewer and I am attempting to move an image from the bottom of the list to the top and it would require scrolling, the viewer does not auto scroll when I hover my cursor near the top of the viewer. This functionality does occur if I have OwnDrop = False, however if I set the OwnDrop to false then I lose my drag an drop between thumb viewers.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Drag and Drop

Post by Loïc » Tue Oct 09, 2012 12:09 pm

Hello,
the viewer does not auto scroll when I hover my cursor near the top of the viewer
The autoscroll feature behaves only when AllowMoveItems is set to true. And AllowMoveItems is automatically set to False when OwnDrop is set to true.

Therefore, it is not possible to use the autoscroll when the OwnDrop is true.


Hope this clarify.

Kind regards,

Loïc

Nagendra
Posts: 1
Joined: Tue Jul 02, 2019 8:21 am

Re: Drag and Drop

Post by Nagendra » Tue Jul 02, 2019 8:28 am

You will find C# & vb.NET samples in our latest package. Just search for "Thumbnail - Drag And Drop" demo project. It is working as expected in C# demo project but not working on WPF demo sample.
You need to handle the "Manipulation" events and "Touch" events when developing your application.
I have faced the same issue and able to scroll with the following code,

private void ExtractScrollViewerFromVSTree(DependencyObject element, double pagePosition)
{
try
{
int totalElementcount = VisualTreeHelper.GetChildrenCount(element);
for (int counter = 0; counter < totalElementcount; counter++)
{
DependencyObject eleDependencyObject = VisualTreeHelper.GetChild(element, counter);
if (eleDependencyObject.GetType().Name == "ScrollViewer")
{
ScrollViewer scrollViewer = eleDependencyObject as ScrollViewer;
if (pagePosition > 'YourAssumption') // for me it is 610
{
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + 45);
}
else if (pagePosition < 'YourAssumption') //for me it is 40
{
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - 45);
}
break;
}
ExtractScrollViewerFromVSTree(VisualTreeHelper.GetChild(element, counter), pagePosition);
}
}
catch(Exception ex)
{
}
}

In the above method, you need to pass ThumbnailEx object as an input and the dragposition of page. It is a recursive method to get the scrollviewer control inside the thumbnail control with the help of visual tree.

Let me know if you need further help.

Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 1 guest