how to change the inertia of scatterviewitem , i want move the scatterviewitem to out of screen.

Proposed how to change the inertia of scatterviewitem , i want move the scatterviewitem to out of screen.

  • Monday, July 30, 2012 2:59 AM
     
     

    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.

    blow are my code:

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

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

         </s:ScatterView>

    • Edited by tomsont Monday, July 30, 2012 3:08 AM
    •  

All Replies

  • Monday, July 30, 2012 6:22 AM
     
     Proposed Has Code

    Hello

    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);
            }

    hpe it helps

    regards

    serge


    Your knowledge is enhanced by that of others.