【问题标题】:what does means Binding with no source property in silverlight?Silverlight中没有源属性的绑定是什么意思?
【发布时间】:2011-09-26 20:56:25
【问题描述】:

我不是新手,我对数据绑定有疑问。

我通常使用{binding propertyName,...} 绑定一些东西,但在一些帖子/博客中我可以看到类似ItemsSource="{Binding}" 的代码。为什么不使用ItemsSource="{Binding YourCollection}"

有什么区别?

谢谢! :=)

【问题讨论】:

    标签: silverlight binding


    【解决方案1】:

    有时当前的DataContext 为某些 ItemsControl 提供项目的集合,例如 ListBox。在这种情况下,没有要绑定的属性,源对象作为一个整体是要分配给ItemsSource 属性的值。这就是ItemsSource="{Binding}" 的意思。如果未指定属性路径,则传入绑定的Source 对象。

    ItemsSource="{Binding YourCollection}" 表示在Source 对象上找到名为YourCollection 的属性并将其值传递给ItemsSource

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-18
      • 2019-10-31
      • 1970-01-01
      • 2019-09-13
      • 2018-09-14
      • 1970-01-01
      • 1970-01-01
      • 2020-11-24
      相关资源
      最近更新 更多