private async void grid_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { //虚拟化会重新执行此方法绑定数据 //await grid.AnimateAsync(new FadeInLeftAnimation()); //await grid.AnimateAsync(new BounceInDownAnimation()); if (IsCampaign) { this.coverGrid.Opacity = 0.0; } else { this.coverGrid.Opacity = 1.0; } var g = sender as Grid; if (g != null && !isLoaded) { await Task.Delay(500); var animationName = new FadeInDownAnimation(); animationName.Distance = 150; g.AnimateAsync(animationName); isLoaded = true; } }
public AnimationDefinition GetAnimation() { AnimationDefinition animationDefinition = null; var randomIndex = new Random().Next(0, 10); switch (randomIndex) { case 0: animationDefinition = new FadeInUpAnimation(); break; case 1: animationDefinition = new BounceInLeftAnimation(); break; case 2: animationDefinition = new BounceInUpAnimation(); break; case 3: animationDefinition = new BounceInDownAnimation(); break; case 4: animationDefinition = new FadeInDownAnimation(); break; case 5: animationDefinition = new FadeInLeftAnimation(); break; case 6: animationDefinition = new FadeInRightAnimation(); break; case 7: animationDefinition = new BounceInRightAnimation(); break; case 8: animationDefinition = new FadeInAnimation(); break; case 9: animationDefinition = new BounceInAnimation(); break; } return(animationDefinition); }
private async void rootGrid_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { //虚拟化会重新执行此方法绑定数据 //await grid.AnimateAsync(new FadeInLeftAnimation()); //await grid.AnimateAsync(new BounceInDownAnimation()); var g = sender as Grid; if (g != null && !isLoaded) { await Task.Delay(500); var animationName = new FadeInDownAnimation(); animationName.Distance = 100; g.AnimateAsync(animationName); isLoaded = true; } }
private async void grid_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { //这里和虚拟化有关的,非常重要不可以删除 if (AppEnvironment.IsPhone) { this.guestureGrid.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.System; this.guestureGrid.ManipulationDelta -= Grid_ManipulationDelta; this.guestureGrid.ManipulationCompleted -= Grid_ManipulationCompleted; this.guestureGrid.ManipulationStarted -= GuestureGrid_ManipulationStarted; this.guestureGrid.ManipulationDelta += Grid_ManipulationDelta; this.guestureGrid.ManipulationCompleted += Grid_ManipulationCompleted; this.guestureGrid.ManipulationStarted += GuestureGrid_ManipulationStarted; this.gridEdit.Visibility = Visibility.Collapsed; } else { this.gridEdit.Tapped -= gridEdit_Tapped; this.gridEdit.Tapped += gridEdit_Tapped; } //虚拟化会重新执行此方法绑定数据 //await grid.AnimateAsync(new FadeInLeftAnimation()); //await grid.AnimateAsync(new BounceInDownAnimation()); var g = sender as Grid; if (g != null && !isLoaded) { await Task.Delay(500); var animationName = new FadeInDownAnimation(); animationName.Distance = 150; g.AnimateAsync(animationName); isLoaded = true; } }
private static AnimationDefinition GetAnimationDefinition(string animationName) { AnimationDefinition animationDefinition = null; if (animationName != null) { switch (animationName.ToLower()) { case "flash": animationDefinition = new FlashAnimation(); break; case "bounce": animationDefinition = new BounceAnimation(); break; case "shake": animationDefinition = new ShakeAnimation(); break; case "tada": animationDefinition = new TadaAnimation(); break; case "swing": animationDefinition = new SwingAnimation(); break; case "wobble": animationDefinition = new WobbleAnimation(); break; case "pulse": animationDefinition = new PulseAnimation(); break; case "breathing": animationDefinition = new BreathingAnimation(); break; case "jump": animationDefinition = new JumpAnimation(); break; case "flip": animationDefinition = new FlipAnimation(); break; case "flipinx": animationDefinition = new FlipInXAnimation(); break; case "flipoutx": animationDefinition = new FlipOutXAnimation(); break; case "flipiny": animationDefinition = new FlipInYAnimation(); break; case "flipouty": animationDefinition = new FlipOutYAnimation(); break; case "fadein": animationDefinition = new FadeInAnimation(); break; case "fadeout": animationDefinition = new FadeOutAnimation(); break; case "fadeinleft": animationDefinition = new FadeInLeftAnimation(); break; case "fadeinright": animationDefinition = new FadeInRightAnimation(); break; case "fadeinup": animationDefinition = new FadeInUpAnimation(); break; case "fadeindown": animationDefinition = new FadeInDownAnimation(); break; case "fadeoutleft": animationDefinition = new FadeOutLeftAnimation(); break; case "fadeoutright": animationDefinition = new FadeOutRightAnimation(); break; case "fadeoutup": animationDefinition = new FadeOutUpAnimation(); break; case "fadeoutdown": animationDefinition = new FadeOutDownAnimation(); break; case "bouncein": animationDefinition = new BounceInAnimation(); break; case "bounceout": animationDefinition = new BounceOutAnimation(); break; case "bounceinleft": animationDefinition = new BounceInLeftAnimation(); break; case "bounceinright": animationDefinition = new BounceInRightAnimation(); break; case "bounceinup": animationDefinition = new BounceInUpAnimation(); break; case "bounceindown": animationDefinition = new BounceInDownAnimation(); break; case "bounceoutleft": animationDefinition = new BounceOutLeftAnimation(); break; case "bounceoutright": animationDefinition = new BounceOutRightAnimation(); break; case "bounceoutup": animationDefinition = new BounceOutUpAnimation(); break; case "bounceoutdown": animationDefinition = new BounceOutDownAnimation(); break; case "scalein": animationDefinition = new ScaleInAnimation(); break; case "scaleout": animationDefinition = new ScaleOutAnimation(); break; case "lightspeedinleft": animationDefinition = new LightSpeedInLeftAnimation(); break; case "lightspeedinright": animationDefinition = new LightSpeedInRightAnimation(); break; case "lightspeedoutleft": animationDefinition = new LightSpeedOutLeftAnimation(); break; case "lightspeedoutright": animationDefinition = new LightSpeedOutRightAnimation(); break; case "hinge": animationDefinition = new HingeAnimation(); break; case "reset": animationDefinition = new ResetAnimation(); break; } } return(animationDefinition); }