gpt4 book ai didi

wpf - 这个 WPF 绑定(bind)是什么意思?

转载 作者:行者123 更新时间:2023-12-04 06:51:08 24 4
gpt4 key购买 nike

我有这个示例代码:

<ControlTemplate Content="{Binding .}"/>

与绑定(bind)有关的这一点是什么意思?

最佳答案

.绑定(bind)的(句号)是指绑定(bind)路径,简单的告诉它绑定(bind)到当前源(即继承的DataContext)。

来自 MSDN page :

Optionally, a period (.) path can be used to bind to the current source. For example, Text=”{Binding}” is equivalent to Text=”{Binding Path=.}”.



另请注意 Path=如果 Path 是第一个参数,则可以省略,因此您的代码含义完全相同。我倾向于只喜欢 {Binding}语法,虽然这取决于你。

关于wpf - 这个 WPF 绑定(bind)是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3117111/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com