Why do certain properties need to be surrounded in parenthesis..ex: Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)
The title pretty much sums it up. I was stuck on an issue with a ColorAnimation not working properly. I eventually figured out that the TargetProperty had to be surrounded in parenthesis...although I don't fully understand why?
Any ideas? (Specifically note: Storyboard.TargetProperty=") Why must they be in parenthesis?
<Style.Resources> <ColorAnimation x:Key="RecordingAnimation" Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" From="White" To="Blue" Duration="0:0:0.5" AutoReverse="True" RepeatBehavior="Forever"/> <ColorAnimation x:Key="StopRecordingAnimation" Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" To="White" Duration="0:0:0.1"/> </Style.Resources>
Think like a parser, which wants to parse the code you wrote. If you wanna find a propery named "Background.SolidColorBrush.Color" in the target object and knowing which type has been set into the property, clearly you can't! Because there is no such a property in the target object. "Background" section refers to the property name and "SolidColorBrush" refers to the object type that has been set into the property. It is not like path in Binding object that you can write a complete path for referencing an property.
I hope this helps.
The parentheses are needed when you are referencing either
- multiple objects and subproperties, or
- an attached property name
Please see Storyboard.TargetProperty for more information.