round brackets in xaml syntax

守給你的承諾、 提交于 2019-12-04 13:02:46

问题


when I'm using ColorAnimation to change Background of control i'm using following syntax:

<ColorAnimation Duration="0:0:0.5" 
 Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" 
 To="Black" />

I'm very happy it works but I couldn't find any information about round braces in xaml syntax reference ...

So could you please explain where does this syntax come from and what does the round brace actually mean?

It would be very helpful. Thanks


回答1:


Please see PropertyPath XAML Syntax:

The parentheses indicate that this property in a PropertyPath should be constructed using a partial qualification. It can use an XML namespace to find the type with an appropriate mapping. The ownerType searches types that a XAML processor has access to, through the XmlnsDefinitionAttribute declarations in each assembly. Most applications have the default XML namespace mapped to the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace, so a prefix is usually only necessary for custom types or types otherwise outside that namespace. propertyName must resolve to be the name of a property existing on the ownerType. This syntax is generally used for one of the following cases:

  • The path is specified in XAML that is in a style or template that does not have a specified Target Type. A qualified usage is generally not valid for cases other than this, because in non-style, non-template cases, the property exists on an instance, not a type.

  • The property is an attached property.

  • You are binding to a static property.



来源:https://stackoverflow.com/questions/4640573/round-brackets-in-xaml-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!