MatrixAnimationUsingPath.IsAdditive Propriété

Définition

Obtient ou définit une valeur qui indique si la valeur actuelle de la propriété cible doit être ajoutée à la valeur de départ de cette animation.

public:
 property bool IsAdditive { bool get(); void set(bool value); };
public bool IsAdditive { get; set; }
member this.IsAdditive : bool with get, set
Public Property IsAdditive As Boolean

Valeur de propriété

true si la valeur actuelle de la propriété cible doit être ajoutée à la valeur de départ de cette animation ; sinon, false. La valeur par défaut est false.

Exemples

L’exemple suivant utilise deux animations similaires MatrixAnimationUsingPath pour animer le même rectangle. La propriété de la IsAdditive première animation a la falsevaleur , de sorte qu’elle anime toujours le rectangle à partir de (0,0), la valeur de départ de l’animation. La deuxième animation a les mêmes valeurs cibles (leurs PathGeometry paramètres sont identiques), mais sa IsAdditive propriété est définie sur true; par conséquent, elle anime le rectangle à partir de n’importe quelle position où elle se trouve lors de l’application de l’animation.

<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" 
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="PresentationOptions">
  <StackPanel>
      
    <!-- The Rectangle that is animated across the screen by animating
         the MatrixTransform applied to the button. -->
    <Rectangle 
      Width="50" Height="20"
      Fill="Blue"
      HorizontalAlignment="Left"
      VerticalAlignment="Top">
      <Rectangle.RenderTransform>
        <MatrixTransform x:Name="myMatrixTransform">
          <MatrixTransform.Matrix >
            <Matrix OffsetX="10" OffsetY="100"/>
          </MatrixTransform.Matrix>
        </MatrixTransform>
      </Rectangle.RenderTransform>
    </Rectangle>
    
    <StackPanel Margin="0,200,0,0" Orientation="Horizontal">
    <Button Content="Animate with IsAdditive set to False"
      HorizontalAlignment="Left" Padding="5">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>
            
              <!-- This animation always moves the 
                   rectangle back to (0,0). -->
              <MatrixAnimationUsingPath
                Storyboard.TargetName="myMatrixTransform"
                Storyboard.TargetProperty="Matrix"
                Duration="0:0:2" 
                DoesRotateWithTangent="True" 
                IsAdditive="False">
                <MatrixAnimationUsingPath.PathGeometry>
                  <PathGeometry 
                    Figures="M 0,0 C 35,0 135,0 160,100 180,190 285,200 310,100" />
                </MatrixAnimationUsingPath.PathGeometry>
              </MatrixAnimationUsingPath>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>   
    </Button>
    
     <Button Content="Animate with IsAdditive set to True"
      HorizontalAlignment="Left" 
      Padding="5">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>
            
              <!-- This animation moves the rectangle from 
                   its current position. -->
              <MatrixAnimationUsingPath
                Storyboard.TargetName="myMatrixTransform"
                Storyboard.TargetProperty="Matrix"
                Duration="0:0:2" 
                DoesRotateWithTangent="True"
                IsAdditive="True">
                <MatrixAnimationUsingPath.PathGeometry>
                  <PathGeometry 
                    Figures="M 0,0 C 35,0 135,0 160,100 180,190 285,200 310,100" />
                </MatrixAnimationUsingPath.PathGeometry>
              </MatrixAnimationUsingPath>
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>   
    </Button>   
    </StackPanel>
    
    
  </StackPanel>
</Page>

Remarques

Informations sur les propriétés de dépendance

Champ Identificateur IsAdditiveProperty
Propriétés de métadonnées définies sur true Aucun

Notes

Cette propriété de dépendance est inhabituelle, car le champ d’identificateur pour elle provient de AnimationTimeline et est partagé par différentes classes dérivées.

S’applique à