<Window x:Class="ImageZoomTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowState="Maximized">
<Grid Margin="0" Name="gridMain">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0">
<Image Name="imageLarge" Source="Image\1600XMAS_3001.jpg" Width="800" Height="500">
<Image.RenderTransform>
<RotateTransform x:Name="imageLargeRotateTransform" Angle="0"/>
</Image.RenderTransform>
</Image>
</DockPanel>
<DockPanel Grid.Column="1">
<Button Name="btnRotateClockwise" Content="Rotate clockWise" DockPanel.Dock="Bottom" >
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="imageLargeRotateTransform" Storyboard.TargetProperty="Angle" By="90" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</DockPanel>
</Grid>
</Window>解决这种现象的方法很简单,只要在BeginStoryboard里面设置HandoffBehavior属性为Compose就可以了: <BeginStoryboard HandoffBehavior ="Compose" >。
浙公网安备 33010602011771号