如何改变scatterviewitem的惯性,我想将scatterviewitem移到屏幕外。 [英] how to change the inertia of scatterviewitem , i want move the scatterviewitem to out of screen.

查看:106
本文介绍了如何改变scatterviewitem的惯性,我想将scatterviewitem移到屏幕外。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我移动scratchterviewitme它总是停在屏幕一侧。我想改变它,当我移动它时,它可以飞出屏幕。请给我一些帮助。谢谢。

hello, i move scratterviewitme it always stop at screen side. i want change it, when i move it , it can fly out of screen. pls give me some help. thank you.

打击是我的代码:

   < s:ScatterView x:Name =" mainScatterView">

   <s:ScatterView x:Name="mainScatterView">

            < S:ScatterView.ItemTemplate>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < DataTemplate>&
                    <图像源=" {结合}" />

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP; < / DataTemplate>&
            < / s:ScatterView.ItemTemplate>

            <s:ScatterView.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding}"/>
                </DataTemplate>
            </s:ScatterView.ItemTemplate>

     < / s:ScatterView>

     </s:ScatterView>

推荐答案

Hello

Hello

将scatterview移出屏幕您可以在scatterwiew的中心使用动画。通过检查散点图中心位置何时触及屏幕的边缘,您可以使用以下方法将其从屏幕中删除:

to move scatterview out of the screen you can use an animation on the Center of the scatterwiew. By checking when the scatterview center position is hitting the edg of the screen, you can use the follwing method to remove them from screen:

public static void TranslateBeforeRemove(ObservableCollection<ScatterViewItem> Collection, ScatterViewItem svi)        {            Point RemovePoint = new Point(svi.ActualCenter.X + (1920 - svi.ActualCenter.X) + 800, svi.ActualCenter.Y);            PointAnimation CenterAnimation = new PointAnimation(svi.ActualCenter, RemovePoint, TimeSpan.FromSeconds(1), FillBehavior.Stop);            CenterAnimation.AccelerationRatio = 0.5;            CenterAnimation.DecelerationRatio = 0.0;            CenterAnimation.FillBehavior = FillBehavior.Stop;            CenterAnimation.Completed += delegate(object send, EventArgs ev)            {                Collection.Remove(svi);            };            svi.IsEnabled = false;            svi.BeginAnimation(ScatterViewItem.CenterProperty, CenterAnimation);        }

hpen it help

hpe it helps

问候

serge


这篇关于如何改变scatterviewitem的惯性,我想将scatterviewitem移到屏幕外。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆