Storyboard.TargetName attached property
Gets or sets the name of the object to animate.
<object Storyboard.TargetName="nameString" />
XAML Values
- nameString
-
The Name or x:Name value of the element where the property to be animated exists.
Remarks
The value of Storyboard.TargetName must refer to an existing element that has that same string assigned as its Name or x:Name attribute. You almost always set both Storyboard.TargetName and Storyboard.TargetProperty together on any given animation you define in XAML.
For more info on the general concepts of storyboards and timelines, see Storyboarded animations.
Attempting to set Storyboard.TargetName on a running animation will cause a run-time error. However, you can retarget an existing animation is stopped or not yet running. If you do so, be careful not to retarget an animation to the wrong type of target (one that does not support the existing Storyboard.TargetProperty). Otherwise, you will get a run-time error.
Storyboard.TargetName is an attached property, which supports a XAML usage. When getting this property in code, use GetTargetName. When setting this property in code, use SetTargetName instead. In code usages, the target parameter is the object where the attached property value is set. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing TargetNameProperty as the dependency property identifier.
Requirements (Windows 10 device family)
|
API contract | |
|---|---|
|
Namespace |
Windows.UI.Xaml.Media.Animation |
|
Metadata |
Requirements (Windows 8.x and Windows Phone 8.x)
|
Minimum supported client |
Windows 8 |
|---|---|
|
Minimum supported server |
Windows Server 2012 |
|
Minimum supported phone |
Windows Phone 8.1 [Windows Runtime apps only] |
|
Namespace |
Windows.UI.Xaml.Media.Animation |
|
Metadata |
|
See also
- Storyboard.TargetProperty
- Storyboard
- XAML overview
- Storyboarded animations
- Attached properties overview