Manipulation Events Causing UI to Freeze or Become Slow
I am working with multi-touch in order to allow a pinching action on an item. I have a DispatchTimer
looping through a set of images, and when I pinch, I change out the current Image
control (which I extended) so that it appears you are pinching the animation.
I have done all sorts of optimization, but I just cannot figure out why the animations freeze or get really slow while my fingers are moving on the screen. Even when I disabled everything but the image animation, moving my fingers still causes the same issue.
Also, when I have multiple animations using DispatchTimer
, pinching on one of them freezes the rest. Is there something that I am missing? Why does the entire UI seem to freeze while I am touching on the screen?
My manipulation event that freezes the UI.
private void _ManipulationDelta(object sender, ManipulationDeltaEventArg开发者_StackOverflows e)
{
if (e.Manipulators.Count() < 2) return;
e.Handled = true;
return;
}
Update: I find that the UI freezes even when an empty event handler is attached to the ManipulationDelta
event and Manipulation is turned on.
Solved this by optimizing my code outside of the Manipulation handler.
Nevertheless this behavior is a bug.
https://connect.microsoft.com/VisualStudio/feedback/details/782456/wpf-touch-event-fires-with-delay
精彩评论