wpf - xaml 语法中的圆括号

标签 wpf xaml rounding brackets coloranimation

当我使用 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/

相关文章:

c# - 在 ItemsControl 中移动行为

c# - 如何重置 DispatcherTimer?

c# - 将一个类中的值绑定(bind)到另一类中的另一个值

.net - 为什么我的 WPF 应用程序在某些系统上运行缓慢

c# - 如何更新 MainWindow 中 StatusBarItem 中的 WPF UserControl 属性形成另一个具有不同 DataContexts 的 UserControl?

Magento 和 Paypal 税收四舍五入问题

ruby - Ruby 中 float 的一致舍入

Java:四舍五入到最接近 5 的倍数(向上或向下)

.net - 如何立即释放WPF应用程序中的内存以便它可以反射(reflect)在TaskManager中?

c# - WPF C# 从 App 调用窗口函数