gpt4 book ai didi

wpf - xaml 语法中的圆括号

转载 作者:行者123 更新时间:2023-12-04 11:44:11 24 4
gpt4 key购买 nike

当我使用 ColorAnimation 更改控制背景时,我使用以下语法:

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

我很高兴它有效,但我在 xaml 语法引用中找不到任何有关圆括号的信息......

那么你能解释一下这个语法是从哪里来的,圆括号实际上是什么意思吗?

这将非常有帮助。
谢谢

最佳答案

请查看 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.

关于wpf - xaml 语法中的圆括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4640573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com