WPF Bug List (12)--binding path Run-time error associated with custom attached property
We all know the format of databinding is this:
{Binding Path=propertyname}
The path= of these words can be omitted. Thus Jane writes:
{Binding PropertyName}
This behavior is also specifically described in MSDN.
The "Parse error" referred to in this article means that when the property is a custom attachedproperty, the second type produces a run-time error. As shown in the following code:
Demo Code
<Window x:Class="BindingPathBug.DemoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation& quot;
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BindingPathBug"
Title="{Binding (ToolTipService.ToolTip), ElementName=button} "
Height="300" Width="300">
<Button x:Name="button"
ToolTipService.ToolTip="Tooltip"
Content="{Binding (local:ContentService.Content), ElementName=button}"
local:ContentService.Content="Button Content"/>
</Window>
Where the first binding can be run correctly. The second binding is not functioning correctly. It has to be written as follows.
Content= "{Binding path= (local:ContentService.Content), Elementname=button}"
This should be the parse error of binding Markup extension. The entire program can be downloaded from here.
Some people (including me) in the binding will be "Path" this keyword omitted, but in binding to custom attached property when repeatedly try all cool! But I just don't know what the problem is. In the end, I stumbled into adding "Path" and wanted to greet Microsoft Dev and QA.
The good news is that the bug has been fix in. NET 4.0 Beta2. After all, the entire XAML parsing is rewritten.