-
Notifications
You must be signed in to change notification settings - Fork 230
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
[Documentation] Pointer Capture and Other Mouse/Touch Events #35
Comments
FYI the most complete implementation of any docking system in avalonia is... you may be able to use that, or figure out some of these things from the code there. |
With in-process drag-n-drop you should get exactly the same IDataObject that you've passed to DoDragDrop, so no serialization is needed. If it's not the case, please, file an issue. |
Ah, I see. I was confused because of the presence of the DataFormats enumeration made me believe that DataFormats.Text and DataFormats.FileNames were the only valid data types. I guess the next question is what happens when you try to pass an arbitrary object across process boundaries. It seems like there's a lot of potential for bad things to happen here. Should there be an way to restrict drop targets to those existing in the current assembly? What about using ISerializable or System.IO.Stream? |
Mostly nothing. When DnD happens between processes we enumerate data formats supported by your data object and convert those to platform-specific APIs. So if your data object doesn't contain anything the target app won't see any compatible formats and refuse the DnD operation. For custom formats we currently only handle |
There's basically no documentation about mouse and touch events, and there's a decent bit of nuance that's not necessarily obvious.
One big example is capture. When is capture gained? When is it lost? What happens if the control which has captured the pointer has is moved/deactived/hidden while the mousebutton is still down? I don't want to deal with missing button release events.
Another use case is finding out what control is beneath the pointer when the button is released. In my case, I want a Visual Studio like docking control, so I'm handing over a control to a different part of the visual and logical trees on mouse release, provided the mouse is over a valid target.
The problem is that DragDrop is severely inadequate for this sort of use. I can of course serialize a reference into a string and back again, and use reflection to validate types, but this is a horrible kludge, and I don't particularly want my app leaking object references or other odd side effects if the user happens to drag something meant for internal use off to another program or over a textbox or something. However, to my knowledge, there just isn't a better way to do it.
The text was updated successfully, but these errors were encountered: