Reputation: 23831
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?
Thanks for your time.
Upvotes: 2
Views: 359
Reputation: 2875
This is because The Binding cannot determine the complete Expression you want to bind to. If you put it into braces the complete expression (with namespace etc.) can be determined correctly.
If you write (dataAccess:DataGridTextSearch.IsAnyTextMatch)
with braces the markup parser will take your whole binding as ONE expression. Otherwise it would stuck trying to bind to dataAccess:
. With braces you will have an explicit statement that this is one single expression
I hope you finall got me :)
Upvotes: 1
Reputation: 23831
Multiple Property (Indirect Property Targeting)
<Binding Path="propertyName.propertyName2" .../>
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
.
Single Property, Attached or Otherwise Type-Qualified
<object property="(ownerType.propertyName)" .../>
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.
For use as storyboard target, the property specified as propertyName must be a DependencyProperty
.
Upvotes: 0