日期:2014-05-18  浏览次数:21102 次

wpf 用cs代码写动画
<Image x:Name="img" Grid.Row="0"
  HorizontalAlignment="Left"
  Margin="0,0,0,0"
  Source="{Binding ElementName=self, Path=ImageUrl}"
  Stretch="Fill"
  VerticalAlignment="Top"
  Loaded="img_Loaded">
  <VisualStateManager.VisualStateGroups>
  <VisualStateGroup x:Name="CommonStates">
  <VisualStateGroup.Transitions>
  <VisualTransition From="ImageChanged1" GeneratedDuration="0:0:2" To="ImageChanged2">
  <ei:ExtendedVisualStateManager.TransitionEffect>
  <ee:SmoothSwirlGridTransitionEffect/>
  </ei:ExtendedVisualStateManager.TransitionEffect>
  <VisualTransition.GeneratedEasingFunction>
  <BackEase EasingMode="EaseInOut" Amplitude="2"/>
  </VisualTransition.GeneratedEasingFunction>
  </VisualTransition>
  <VisualTransition From="ImageChanged2" GeneratedDuration="0:0:2" To="ImageChanged1">
  <ei:ExtendedVisualStateManager.TransitionEffect>
  <ee:RadialBlurTransitionEffect/>
  </ei:ExtendedVisualStateManager.TransitionEffect>
  <VisualTransition.GeneratedEasingFunction>
  <BackEase EasingMode="EaseInOut"/>
  </VisualTransition.GeneratedEasingFunction>
  </VisualTransition>
  </VisualStateGroup.Transitions>
  <VisualState x:Name="ImageChanged2"/>
  <VisualState x:Name="ImageChanged1"/>
  </VisualStateGroup>
  </VisualStateManager.VisualStateGroups>

  <VisualStateManager.CustomVisualStateManager>
  <ei:ExtendedVisualStateManager/>
  </VisualStateManager.CustomVisualStateManager>
  </Image>


如何用cs代码实现以上代码功能

------解决方案--------------------
不懂wpf的飘过
------解决方案--------------------
你为什么想把这些用cs代码来实现呢,你不会想把这个做到winform里吧
如果是的话,还是别想了,整个原理都不一样的