Does anyone have any idea how to fix this?
All you say adds up, buttons consume input very hungrily and rob you of granular control - input handling. OnPreviewMouseButtonDown
may work but may as well open another can of worms. Imho, not worth it.
The solution is not to use the native buttons - I’d like to say at all but, at least, avoid them for drag & drop ops. Make your own button instead - create a widget with a border, add the necessarily functionality and use it in place of native buttons.
This approach also comes with a ton of side benefits. For example, lets say we’d like to change the buttons’ looks throughout the game - I’d hate to revisit 143 (sub)widgets in 10 menus and manually update all them buttons… (and I do know about styling).
But since we’ve been using a wrapper for a border, we need to do it only once and the amend will propagate. And you can then take advantage of inheritance, which is pretty much a must for anything beyond the most simple menu.
Don’t even get me started on right clicking a button, clicking through a button and forcing a release… Buttons are tempting because they’re set up nicely, with events, sounds, hover states. But that makes them very inflexible at the same time.
tl;dr: native buttons are an evil trap if you ever want to use them for things other than simple clicks