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>

Answers


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.

Cheers


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.


Need Your Help

Is it possible to add custom annotation without pin in xcode?

annotations android-mapview

I need the annotation in the center of map just show me the title and no pin.

Displaying a image from a URL in Android dialog

android image dialog

How would one go about displaying an image in the Android Dialog that is retrieved from the internet from a URL? I have seen examples of Dialogs with pictures (like here:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.