Sets the value of the Storyboard.TargetProperty XAML attached property for a target element.
Syntax
Parameters
- element
-
Type: Timeline
The target element for which to set the value.
- path
-
Type: System.String [.NET] | Platform::String [C++]
The Storyboard.TargetProperty value of the target element to set. This specifies a qualification path that is used by an internal type conversion in order to target the dependency property where the animation applies. See Remarks.
Remarks
Property paths for animation property targeting
The Storyboard.TargetName property can process a string syntax that enables targeting a subproperty of a property value. The syntax uses a "dot-down" metaphor for targeting a chain of object-property relationships until a particular subproperty is identified. This enables animations to apply to the value types where there is a supporting animation structure (Double, Color, Point, and Object for DiscreteObjectKeyFrameAnimation). For example, you might want to animate the Background value of a Control, which takes an object type of Brush. There is no "BrushAnimation" animation type, so you cannot directly target an animation for Background . But what you can do instead is reference a SolidColorBrush subproperty that is named Color, which takes type Color and can thus be targeted by a ColorAnimation. The string syntax for this is:
(Control.Background).(SolidColorBrush.Color)
The parentheses around "(Control.Background)" inform the processing that the intermediate "dot" should not "dot down" and is instead part of the qualification name that finds the base Background property for targeting. The following "dot" is treated as a "dot-down" instruction, which requests a subproperty of the Brush type. The final "(SolidColorBrush.Color)" fragment again includes the parentheses so that the interior "dot" is used as type.member qualification, not a "dot-down".
Note that for subproperty values, there can be some value inference. For example, the following string works by inference even though "Color" is actually a value of the particular Brush subclass SolidColorBrush:
(Control.Background).Color
When you specify a path value for the path parameter, you specify the string, and if you retrieve the value again using GetTargetProperty, you also get the value as a string. This is in contrast to some other implementations of animation property targeting concepts such as WPF, which use a representative object type to store the property path information.
There is a lot more to property path specification than this. This remark is just intended to get you started with the basic targeting scenarios. For more information, see Animation Quickstart.
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012