3

行と列を一緒に変更する必要があります。これは可能ですか?検索しましたが、答えが見つかりませんでした

        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 コード:

   <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>
4

1 に答える 1

2

RowPropertyとはプロパティでColumnPropertyあるInt32ため、Int32Animation

例:

    var da = new Int32Animation();
    da.From = 0;
    da.To = 2;
    da.Duration = new Duration(TimeSpan.FromSeconds(1));
    Soldier.BeginAnimation(Grid.RowProperty, da);
    Soldier.BeginAnimation(Grid.ColumnProperty, da);
于 2013-08-23T05:09:11.810 に答える