maui
maui copied to clipboard
DropGestureRecognier.Drop Event is not Triggered
Description
Two phenomina:
- Handler indicated in XAML is marked gray (meaning it is not referenced)
- Even when manually added that handler in construct method, the handler is not triggered.
Additional info:
After InitializeComponents
, handler indicated in XAML is actually added. (But just not triggered)
Steps to Reproduce
XAML:
<Label Text="Here">
<Label.GestureRecognizers>
<DropGestureRecognizer x:Name="recognizer" Drop="DropGestureRecognizer_Drop" />
</Label.GestureRecognizers>
</Label>
C#:
private async void DropGestureRecognizer_Drop(object? sender, DropEventArgs e)
{
Debug.WriteLine("Triggered");
}
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows, I was not able test on other platforms
Affected platform versions
No response
Did you find any workaround?
Not yet
Relevant log output
No response
Hi @BrandonStudio. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
The code had been provided in first post
Further Details
After a further investigation, I give several conclusions:
- DropGestureRecognizer.Drop and DragGestureRecognizer.DropCompleted events are able to be triggered if and only if the dragged item is a
Control
. - DropGestureRecognizer.DragOver and DropGestureRecognizer.DragLeave are able to be triggered whatever the dragged item is, but EventArgs contains nothing.
- It is not possible to drag a file or text or anything from Windows to WSA on it.
1 and 2 may be due to same reason, which is something I don't know. 3 may not be the problem of .NET MAUI, but be the problem of WSA itself.
Can repro this issue at Windows platform on the latest 17.10 preview2 (8.0.14 &8.0.7)
Duplicated of #6080
They are not completely same. #6080 does not say that Drop event is not triggered.
Any progress on this issue?
They are not completely same. #6080 does not say that Drop event is not triggered.
Right. And that was merged, but I have the same exact issue mentioned in this, which was closed. My events are not triggering. I cannot log them or even hit them with break points. I copied line for line from the documentation.
https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/gestures/drag-and-drop?view=net-maui-8.0&tabs=macios#enable-drop
Have you tried the nightly see if ti works for you? drop event should trigger now.