Dela via


Storyboard.TargetName Attached Property

Definition

Gets or sets the name of the object to animate.

see GetTargetName, and SetTargetName
see GetTargetName, and SetTargetName
see GetTargetName, and SetTargetName

Remarks

Storyboard.TargetName is used to reference another element by its name. The element being referenced is the element/object where the animation should apply. This mechanism is part of the basic design of the animation system: it enables animation resources to be declared separately from UI declaration resources, and makes it possible to apply one animation definition to several different property behaviors. For the value of Storyboard.TargetName on a particular animation, you specify the target element's Name or x:Name attribute value, which is a string. That named element should already exist in some other area of XAML markup.

The meaning of Name/x:Name attribute strings is controlled by a XAML namescope concept. For most animation targeting scenarios you won't need to worry about the influence of XAML namescopes, but you might encounter XAML name resolution issues if you're trying to target template parts, or objects that were created using XamlReader.Load and subsequently added to the object tree. For more info, see XAML namescopes.

Applies to

See also