本文介绍了WPF绑定语法问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了这个语法显示出来,并尝试谷歌它的定义无济于事;什么时候DP势必这种方式,它意味着什么?

I've seen this syntax show up, and have tried to google for it's definition to no avail; what does it mean when a dp is bound this way?

<Grid>
    <ContentControl Content="{Binding}"/>
</Grid>

我是,你必须绑定到DataContext的,或其他元素某些属性的假设下,但是这似乎结合不了了之。

I was under the assumption that you have to bind to some property on the DataContext, or another element, but this appears to bind to nothing.

推荐答案

我相信它意味着你绑定到任何根的结合上下文。所以,如果你在一个DataTemplate是一些列表控件的一部分使用此语法,你会结合无论父控件(列表对照)结合的根目录下。

I believe it means you are binding to the root of whatever the binding context is. So if you use this syntax in a datatemplate that is part of some sort of list control, you would be binding to the root level of whatever the parent control (the list control) was binding to.

这篇关于WPF绑定语法问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:52