Why don't the DragDrop events use Direct routing strategy? #19043
Unanswered
H0tCh0colat3
asked this question in
Q&A
Replies: 1 comment 4 replies
-
I'd only set a flag IsDragging or something. The timing itself I'd do in Pointer*** events |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to determine the length of time that a drag operation hovered over a tab strip item. To do this, I thought I'd listen to the DragEnter/Leave events, but unlike PointerEntered/Exited events, the drag events only seem to fire for child controls of the tab strip's template, never for the control itself. (I think this is how the drag events work for all templated controls?)
So, instead of a single DragEnter event when the pointer crosses the control's bounds, and then a single DragLeave event when it exits, I get events each time the pointer drags into any visual child. This makes it impossible to determine precise timing for when a drag operation actually entered/exited a control.
I did try checking the position at which the events occur, but it seems these usually occur within the control's bounds, unless the pointer moves very fast, which ultimately makes that avenue unreliable.
I also tried filtering based on the difference in number of occurrences of each event, but unfortunately, the drag leave event of the child the pointer is exiting fires before the enter event of the child the pointer is entering does. I suppose this logic is technically correct, but it means I can't invalidate the erroneous drag leave event until the subsequent enter event fires, and by that point it's already too late.
Finally, I've seen old posts about a similar issue in WPF, where the "solution" was to queue whatever work is to be done during drag exit, and if an enter event occurs during some grace period, cancel the queued work, but this feel hacky and fragile to me - it doesn't account for hardware chokes and is, IMO, more cumbersome to setup than should be necessary. Is it really the accepted way to accomplish this?
I can't find any information on this regarding Avalonia specifically, so I can't help but think I'm doing something wrong, but at this point I've exhausted myself trying to figure out a suitable workaround. Does anyone have any insight to this?
Beta Was this translation helpful? Give feedback.
All reactions