This has been bugging me for a long time now and I can’t seem to find a good explanation for it. What is the purpose of the round brackets in this markup? Is it a XAML shortcut for casting? Why does it only seem to be used for animations?
Storyboard.TargetProperty="(TextBlock.RenderTransform).(RotateTransform.Angle)"
This is syntax for specifying a Type qualified
DependencyProperty. It is required, because theStoryboard.TargetPropertyattached property can be attached to anyDependencyObject. That means the XAML parser won’t know how to resolve the properties unless they are fully qualified.This syntax is also used for things like binding to attached properties. Here is a contrived example to demonstrate this:
If you remove the parenthesis from the
Binding, you’ll get a binding error (because there is no Grid property on theBorderelement).