How To Disable Inertia in ScatterView

帅比萌擦擦* 提交于 2019-12-24 08:28:34

问题


Using ScatterView control shipped in Windows Touch WPF. I want to prevent inertia from happening on a scatterview item. But I still want to allow user to move, scale and rotate the item.

So I try this...

   ScatterviewItem svi = new ScatterviewItem();
   svi.ManipulationDelta += OnManipulationDelta;

...

    void OnManipulationDelta(object sender, ManipulationDeltaEventArgs args)
    {
        if (args.IsInertial)
        {
            args.Complete();
            args.Handled = true;
        }
    }

But the event is never firing. Am I doing something wrong, or is there another way to do this, or is preventing inertia simply not possible with scatterview?


回答1:


Not sure why your event is not firing. Another solution is for you to set the deceleration rate of the ScatterViewItem to a suitably high value.




回答2:


The event handler is for when the ScatterView is manipulated. Each item added to the ScatterView would need to have the handler set the same way, which you should be able to do by creating a template for the ScatterViewItem class, or if you're using an ItemsControl, through the item template there.




回答3:


A deceleration rate of 0 will also work




回答4:


Try using a handler for the ContainerManipulationDelta event instead of the ManipulationDelta event



来源:https://stackoverflow.com/questions/2978239/how-to-disable-inertia-in-scatterview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!