我正在将箭头图像从下向上旋转,当用户第一次点击它时它工作正常。
但我的问题是如何在第二次点击时从下到上反转等等......
下面是我的 XAML 图像,它位于 longlistselector 控件中
<Image Grid.Column="2" Tap="ArrowDownImg_Tap" x:Name="ArrowDownImg" Margin="0,-10,-33,0" Height="40" Width="40" Source="/Images/appbar.arrow.down.circle.rest.png" />
旋转图像的点击代码
private void ArrowDownImg_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
Duration duration = new Duration(TimeSpan.FromMilliseconds(500));
Storyboard sb = new Storyboard();
sb.Duration = duration;
DoubleAnimation da = new DoubleAnimation();
da.Duration = duration;
sb.Children.Add(da);
RotateTransform rt = new RotateTransform();
Storyboard.SetTarget(da, rt);
Storyboard.SetTargetProperty(da, new PropertyPath("Angle"));
da.To = 180;
ImageShowHide.RenderTransform = rt;
ImageShowHide.RenderTransformOrigin = new Point(0.5, 0.5);
sb.Begin();
}