Conversation
|
Do you know if this will work in iOS? I think they had some way you can drag things from outside the app. |
| #if WINDOWS | ||
| if (e.PlatformArgs is not null && e.PlatformArgs.DragEventArgs.DataView.Contains(StandardDataFormats.StorageItems)) | ||
| { | ||
| var items = await e.PlatformArgs.DragEventArgs.DataView.GetStorageItemsAsync(); |
There was a problem hiding this comment.
Doe this work in unpackaged? Not sure how all the storage APIs work.
Yeah I didn't test on iOS , I saw and hit myself this issue when writing a desktop app. |
(I have not tested this PR yet nor reviewed it) You can drag and drop from outside apps to another app on iOS, on both iPad and iPhone. On iPad, you can do it via split view. On iPhone, it's more complicated: You need to drag the item, go into multitasking mode (while holding the item with your finger), go to the other app, and drop it in the supported view. I doubt many apps actually support that since it's such a pain to do, but it is doable. The API is the same as Catalyst so it "should" work as is. Again, I have not tested this PR yet., but it should work, and if not... then we should make it work ;). |
|
|
||
| } | ||
| } | ||
| #elif MACCATALYST |
There was a problem hiding this comment.
This works with iOS, so you can enable it here.
drasticactions
left a comment
There was a problem hiding this comment.
Tried it on Mac Catalyst and iOS and worked as expected in both. (To try this with iOS, you need to have an app that can drag items out of it, like Files or Photos, and drag them to the drop target in your app.
I don't understand the remarks made regarding this fix. Can you please kindly explain? |
|
Hey @showtroylove the fix unblocks the crash and users reporting DropGesture not working when dragging something from outside, but the experience for example of providing coordinates a custom drag template etc might not work so that's why I say the experience is not perfect. |
|
Which version will these changes be available? |
|
This should be right now in our nightly feed. Do you mind testing it? Thanks |
|
@rmarinho, I cannot get this to function using the nightly feed as suggested (i.e., 8.0.21). The drag and drag leave triggers, but the drop is nonresponsive. It doesn't appear to even have a handler when registering one in the XAML
|
|
using Operation = Microsoft.Maui.Controls.DataPackageOperation; public partial class MainPage : ContentPage } |
|
can you post a repo link and I can take a look please? thanks |
|
I would appreciate it if you could provide me with a simple example.
You can use this simple app: #6080
The example provided and the following commit resolved the issue:
[Catalyst, Windows] Allow drag item from outside the app #21684
What I'm seeing is that the drop is non-responsive. Under no circumstances
can I get it to trigger.
…On Sat, Apr 20, 2024 at 5:50 AM Rui Marinho ***@***.***> wrote:
can you post a repo link and I can take a look please? thanks
—
Reply to this email directly, view it on GitHub
<#21684 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADO6DLK3PTUQBE2XKTKWOYDY6I25NAVCNFSM6AAAAABF2RIVNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRXGYZDCNZWHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I've had success with @drasticactions' drag and drop sample code found on GitHub. However, it seems his code isn't compatible with the in-app drag and drop features (e.g., DragGestureRecognizer, DropGestureRecognizers, etc.). What's more, his code appears to be affected by the https://github.com/dotnet/maui/issues/16919 known issue and other issues I've corrected related to iOS. Additionally, there appears to be no implementation for Android. |
Description of Change
Seems we can allow the DropGestureRecognizer to work with an item being dragged from outside of our application, like drop a file into the .NET MAUI app and process it.
This does make the experience perfect but unblocks ours users to use the Drop gesture.
Not sure how we test this, I added a sample page that allows to show the path of the file dragged. we can add more logic to this .
I used some sample code from @drasticactions for the native parte..
Issues Fixed
Fixes #6080