Shorten duration before drag? - c#

How can I make the drag & drop functionality activate faster? I want to shorten the duration between the mousedown and the drag and drop activating; so that the user is able to move the item faster.
I currently have it implemented using a ListView with CanDragItems set to true and AllowsDrop on my receiving Grid.
I have been searching, but I can't seem to find my answer anywhere.
I now have added a small animation when the item is touched (PointerPressed), which animates the view, so that the user has something to look at when they are waiting for the drag and drop to activate.

Related

How can I prevent to one finger scrolling for listview control in uwp?

I want to enable just two finger scrolling. I am developing uwp application on windows 10.How can I prevent to one finger scrolling for listview control in uwp?
Bests
You could probably do that, but I won't help you since that would be an evil feature that would confuse the users of your app. Instead, you should consider alternative solutions to whatever you'd like to happen when users use a single finger in a ScrollViewer.
Note that you're essentially trying to change how the ScrollViewer in the ListView template behaves. In most cases, you do that when you want to drag an item out of a list. Most people either handle the press and hold (aka long holding - the Holding event) or a cross-drag (dragging perpendicular to the ScrollViewer panning direction) and call ScrollViewer.CancelDirectManipulations() to stop panning and handle drag & drop instead.
If you just want a single finger panning to stop working - then you should not do that.

Make control transparent to drag events during drag-and-drop

I have a ListView that acts as a drop target for drag and drop operations. When the list is empty, I place a TextBlock over top of it with a message informing users they can drag things there (both controls are contained in a single Grid cell to enable overlap). But... since the TextBlock is on top of the ListView, it intercepts the various events connected to drag and drop and prevents things from being dropped onto the message text itself.
I really don't want to add a drop handler to the TextBlock--is there any way I can simply make it "transparent" to drag and drop operations?
Something that just occurred to me while writing this which does work is to put the text below the list in the Z-order and then give the list a transparent background. But is this really the right way to achieve this? Ideally, there'd be a way to give the text one ZIndex for rendering, and a different one for hit testing.
Set IsHitTestVisible to False for TextBlock.

Debugging drag and drop in wpf?

I have drag and drop working in my application.
However, I have been running into an issue which I am not able to figure out whats causing it...
Basically, I have two itemsControl's where I am enabling drag and drop between them.
When the user drags items, I create a drag adorner and then do a drop preview on the control.
In some cases, when the drag adorner moves from source to the next itemsControl (i.e the target itemsControl where the drop will happen)...The OnPreviewDragLeave() method on the drag source
is not being called!
So the drag adorner just gets stuck on top of the source itemsControl.
This happens only in some cases, the only thing I can think of is that some other element is setting e.Handled to true maybe?
But how can I effectively debug this in an easy way as these events get fired continuosly and setting breakpoints is not really an option...
Any suggestions are appreciated,
thanks

Custom draw selection rectangle

I am working on a custom control based on a ListView control. The goal of the control is to show the events name in the first column and the event duration on a timeline on the second column. I've implemented the custom drawing for the timeline section and it all works.
Now I would like to implement a "zooming" feature. Where the user would be able to click somewhere on the second column drag the mouse and upon release the timeline would be zoomed in with starting and end times matching the mousedown/mouseup events.
Currently when I click/drag the mouse, a normal selection box appears. I would like to overide that such that I get don't get a box but more of a vertical area (so the selection is only based on the timeline axis).
I really don't know where to look and how to overide the drawing the selection box. Any pointers/sample code would be appreciated.
Well if you don't need multi selection option setting MultiSelect property to false disables rubber band selection.

Query Dragging state globally in Windows / DragDrop in WPF

I'm using WPF here, I have some items in a list, which I can drag. As soon as you drag them I use:
DragDrop.DoDragDrop(this, new DragDropCommandItem(), DragDropEffects.Copy);
And animate-in a 'bin' over the UI where you can drag the item if you want to delete it. This all works well, except that I can't seem to do anything to detect when the user released the mouse so that I can hide the 'bin'. The second you call DragDrop.DoDragDrop it appears to release capture of the mouse. So even a system wide mouse down check returns false.
Is there any nice way to do this, or a way to query the drag state?
Any help would be appreciated, thank you.
I found this... I'll close the question now as I can use this solution.
How do I tell if a Drag Drop has ended in Winforms?

Categories