Вопрос

I'm making an app using the Windows Runtime on Windows 8.1. I have a canvas that will allow users to drag different objects around on it, as well as resize these objects. It works a lot like Visual Studio and Blend's UI designer, where you click an object, and can move and resize the object.

My question is: Is there anyway to make a control continue reporting the PointerMoved event, even when the pointer has technically left the actual control, as long as the mouse button is still down?

My issue right now is that, for example, if you try resizing an object using the Resize Grip I provide, and you move the mouse too quickly, it will leave the bounds of the resize grip and, even though the mouse button is still being held down, the pointer move event will stop firing, and the resize will not fully complete.

Is there anyway to make the pointer move event continue firing until the user has released the mouse button?

Это было полезно?

Решение

There's no direct way to keep firing the PointerMoved event when the pointer leaves the hit test area of the original UIElement, it's not a matter of keeping pressing or not, it's a matter of leaving the area of the firing UIElement.

Think about implementing a PointerMoved EventHandler method for the Container of your Element, and subscribe to it when the pointer leaves the area of that Element using the PointerExited event, so that you can keep providing data about the movement of the pointer.

One more thing, you'd better think about using ManipulationEvents, those would give you easier and better solution, try to follow these guidelines to better interact with Touch input.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top