-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] - Handle Dynamic Updates for CanDrag and AllowDrop in Drag and Drop Gesture #27845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] - Handle Dynamic Updates for CanDrag and AllowDrop in Drag and Drop Gesture #27845
Conversation
Hey there @prakashKannanSf3972! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
|
||
[Test] | ||
[Category(UITestCategories.DragAndDrop)] | ||
public void DragAndDropShouldWorkRunTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is failing on Windows:
at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2352
at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2367
at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 663
at Microsoft.Maui.TestCases.Tests.Issues.Issue12726.DragAndDropShouldWorkRunTime() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12726.cs:line 23
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out! The failure appears to be due to the programmatic drop operation not functioning correctly on the Windows platform in the CI environment, despite working on local machines. I have modified the test accordingly, and it should pass in the next CI run.
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
f92c636
to
85ab80c
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
85ab80c
to
5e37143
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
…and Drop Gesture (#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
…and Drop Gesture (dotnet#27845) * Fixed-Drag-And-Drop-RunTime * Modified-Test * Reverted-test * Modified-Code * Reverted-Unwanted-Changes * Modified.
Issue Details
Dynamically changing the
CanDrag
orAllowDrop
property does not enable the expected drag-and-drop functionality when initially set tofalse
. As a result, components cannot be made draggable or droppable by updating these properties at runtime.Root Cause
Event subscriptions were only set up during initialization. Changing
CanDrag
orAllowDrop
dynamically did not trigger a re-subscription, preventing the component from responding to both drag and drop events.Description of Change
Added
PropertyChanged
event handling forDragGestureRecognizer
andDropGestureRecognizer
to ensure that drag-and-drop event subscriptions are updated dynamically when the properties change.Issues Fixed
Fixes #12726
Validated the behaviour in the following platforms
Output
Before-Fix.2.mp4
After-Fix.2.mp4