什么是大括号的XAML绑定路径宣言中的Relevence [英] What is the Relevence of Braces in an XAML Binding Path Declaration

查看:213
本文介绍了什么是大括号的XAML绑定路径宣言中的Relevence的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有的,问题是很简单的。下面结合做的的工作,也就是ascociated 触发不火

All, the question is a simple one. The following binding does not work, that is, the ascociated Trigger does not fire

<DataTrigger Binding="{Binding dataAccess:DataGridTextSearch.IsAnyTextMatch, 
    ElementName=dataGrid}" Value="false"> 

要解决这个问题,使绑定工作,我们把在大括号绑定参考,如下:

to fix this and make the binding work, we place the binding reference in braces, as follows

<DataTrigger Binding="{Binding (dataAccess:DataGridTextSearch.IsAnyTextMatch), 
    ElementName=dataGrid}" Value="false"> 

为什么加括号解决的参考/结合的问题,这是怎么回事?

Why does adding the braces resolve the reference/binding problem and what is going on?

感谢您的时间。

推荐答案

多个属性(间接属性目标)

<Binding Path="propertyName.propertyName2" .../>

propertyName的必须解决是一个属性的名称,它是当前的DataContext 。该路径属性 propertyName的 propertyName2 可存在于一个关系,任何属性其中 propertyName2 是对是值类型存在的属性 propertyName的

propertyName must resolve to be the name of a property that is the current DataContext. The path properties propertyName and propertyName2 can be any properties that exist in a relationship, where propertyName2 is a property that exists on the type that is the value of propertyName.

单属性,附加或否则的Type-合格

<object property="(ownerType.propertyName)" .../>

括号表明,该属性在的PropertyPath 应使用部分资质构造。它可以使用XML命名空间来找到一个适当的映射的类型。在 ownerType 搜索一个XAML处理器访问类型,通过在每个组件中的 XmlnsDefinitionAttribute 声明。大多数应用程序都映射到 http://schemas.microsoft默认XML命名空间。 COM / WinFX的/ 2006 / XAML / presentation 的命名空间,所以preFIX通常只对自定义类型或其它类型的命名空间之外必要的。 propertyName的必须解决在现有的ownerType一个属性的名称。此语法通常用于下列情形之一的:

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:


  1. 的路径在XAML即在样式或模板不具有特定目标类型指定。一个合格的用法通常是无效除此以外的情况下,由于非式,非模板的情况下,物业存在于一个实例,不是一个类型。

  1. 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.

该属性是附加属性。

您绑定到一个静态属性。

You are binding to a static property.

有关用作情节串连图板的目标,指定为propertyName的属性必须用的DependencyProperty

For use as storyboard target, the property specified as propertyName must be a DependencyProperty.

这篇关于什么是大括号的XAML绑定路径宣言中的Relevence的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆