I need to change the row and column Together. Is this possible? I've searched but could not find an answer
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);
xaml code:
<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>
The
RowProperty
andColumnProperty
areInt32
properties, so you will have to use aInt32Animation
Example: