WPF Bug List (12)

Source: Internet
Author: User
Tags parse error xmlns

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.