I've got this piece of code that works just fine: when fired, the LstDevices ListView becomes transparent in 1 second.
private void DoAnimation()
{
Storyboard s = new Storyboard();
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.To = 0;
doubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(1000));
Storyboard.SetTarget(doubleAnimation, LstDevices);
Storyboard.SetTargetProperty(doubleAnimation, "Opacity");
s.Children.Add(doubleAnimation);
s.Begin();
}
Fact is, I need this ListView to do 2 different things:
1) Animate the ListView so instead than becoming invisible, it should disappear by moving off screen. 2) Next step, if I swipe a single item, the single item should disappear by moving offscreen.
Fact is, I can't find the property that modifies the X and Y position of the items I need to move. Anyone has any idea?
I think it would be easiest to do this by using a TranslateTransform with a DoubleAnimation. You can change the X and Y values using the DoubleAnimation over time to give the appearance of moving offscreen.
DoubleAnimation doubleAnimation = new DoubleAnimation();
itemToAnimate.RenderTransform = (Transform)new TranslateTransform();
And then when I have to set the target
Storyboard.SetTarget((Timeline)doubleAnimation, (DependencyObject)itemToAnimate.RenderTransform);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.