/// <summary> 执行方法 </summary> protected override void Invoke(object parameter) { if (this.AssociatedObject == null) { return; } if (this.Target == null) { return; } if (IsUseAll) { var items = this.Target.GetChildren <UIElement>().Where(l => l.RenderTransform is TransformGroup); items = items.Where(l => (l.RenderTransform as TransformGroup).Children.Count == 4); items = items.Where(l => (l as FrameworkElement)?.Tag?.ToString() != "Except"); StoryBoardService.FountainAnimation(items, (int)this.HorizontalRange, (int)this.VerticalRange, Mul, MiddleValue, EndValue, Split); } else { if (this.Target is Panel panel) { var items = panel.Children?.Cast <UIElement>()?.Where(l => l.RenderTransform is TransformGroup); items = items.Where(l => (l.RenderTransform as TransformGroup).Children.Count == 4); StoryBoardService.FountainAnimation(items, (int)this.HorizontalRange, (int)this.VerticalRange, Mul, MiddleValue, EndValue, Split); } } }
void BeginAnimation(IEnumerable <DependencyObject> controls) { if (LoadAnimationType == LoadAnimationType.HorizontalAlignment) { StoryBoardService.BeginAnimationX(controls, this.StartValue, this.EndValue, this.End, this.Split); } else if (LoadAnimationType == LoadAnimationType.VerticalAlignment) { StoryBoardService.BeginAnimationY(controls, this.StartValue, this.EndValue, this.End, this.Split); } else if (LoadAnimationType == LoadAnimationType.Opactiy) { StoryBoardService.BeginAnimationOpacity(controls, this.StartValue, this.EndValue, this.End, this.Split); } }
private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) { if (IsUseAll) { var items = AssociatedObject.GetChildren <UIElement>().Where(l => l.RenderTransform is TransformGroup); items = items.Where(l => (l.RenderTransform as TransformGroup).Children.Count == 4); StoryBoardService.FountainAnimation(items, PointLeft, PointTop, Mul, MiddleValue, EndValue, Split); } else { if (AssociatedObject is Panel panel) { var items = panel.Children?.Cast <UIElement>()?.Where(l => l.RenderTransform is TransformGroup); items = items.Where(l => (l.RenderTransform as TransformGroup).Children.Count == 4); StoryBoardService.FountainAnimation(items, PointLeft, PointTop, Mul, MiddleValue, EndValue, Split); } } }