我需要一起更改行和列。这可能吗?我已经搜索但找不到答案
var da = new DoubleAnimation();
da.From = 0;
da.To = 2;
da.Duration = new Duration(TimeSpan.FromSeconds(1));
Soldier.BeginAnimation(Grid.RowProperty, da);
Soldier.BeginAnimation(Grid.ColumnProperty, da);
xml代码:
<Grid>
<Grid Name="Grm" Width="500" Height="500" Background="#FF14831E">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<Image Name="Soldier" Grid.Row="0" Grid.Column="0" Source="Soldier-Red.png" Width="26" Height="34" MouseLeftButtonDown="Image_MouseLeftButtonDown_1"></Image>
</Grid>
</Grid>