maui icon indicating copy to clipboard operation
maui copied to clipboard

DropGestureRecognier.Drop Event is not Triggered

Open BrandonStudio opened this issue 1 year ago • 1 comments

Description

Two phenomina:

  1. Handler indicated in XAML is marked gray (meaning it is not referenced)
  2. 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

BrandonStudio avatar Jan 25 '24 07:01 BrandonStudio

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.

ghost avatar Jan 26 '24 15:01 ghost

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.

ghost avatar Jan 30 '24 16:01 ghost

The code had been provided in first post

BrandonStudio avatar Jan 31 '24 01:01 BrandonStudio

Further Details

After a further investigation, I give several conclusions:

  1. DropGestureRecognizer.Drop and DragGestureRecognizer.DropCompleted events are able to be triggered if and only if the dragged item is a Control.
  2. DropGestureRecognizer.DragOver and DropGestureRecognizer.DragLeave are able to be triggered whatever the dragged item is, but EventArgs contains nothing.
  3. 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.

BrandonStudio avatar Feb 10 '24 09:02 BrandonStudio

Can repro this issue at Windows platform on the latest 17.10 preview2 (8.0.14 &8.0.7)

jaosnz-rep avatar Apr 02 '24 07:04 jaosnz-rep

Duplicated of #6080

rmarinho avatar Apr 06 '24 18:04 rmarinho

They are not completely same. #6080 does not say that Drop event is not triggered.

BrandonStudio avatar Apr 07 '24 00:04 BrandonStudio

Any progress on this issue?

nappa0326 avatar Apr 17 '24 02:04 nappa0326

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

jonathan-m-phillips avatar Apr 19 '24 01:04 jonathan-m-phillips

Have you tried the nightly see if ti works for you? drop event should trigger now.

rmarinho avatar Apr 19 '24 11:04 rmarinho