我制作了一个用户控件以在单击时展开,其中有 7 个在带有列的网格中。当我单击最后一个时,它会退出屏幕。我想制作动画,如果它展开,那么它应该移动到 grid.column 1,然后当它折叠时它会回到它自己的网格。
代码:
<Grid x:Name="GrdVwSearchResults" Grid.Row="2" Margin="120,70,0,0" >
<Grid.Resources>
<Storyboard x:Name="moveBackAnimation" >
<DoubleAnimation x:Name="moveBackDoubleAnimation" EnableDependentAnimation="True" Storyboard.TargetName="usrFlight5" Storyboard.TargetProperty="Col" From="4" To="1" Duration="0:0:0.5"/>
</Storyboard>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight1" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight2" Grid.Column="1" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0"/>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight3" Grid.Column="2" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0"/>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight4" Grid.Column="3" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0"/>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight5" Grid.Column="4" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0"/>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight6" Grid.Column="5" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0"/>
<usercontrol:Top3SearchResultDisplay x:Name="usrFlight7" Grid.Column="6" Height="440" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0"/>
</Grid>