我已经在App.Resources中创建了一个mycustomItemsPanel
<Application.Resources>
<ItemsPanelTemplate x:Key="mycustomItemsPanel">
.... Some code here
</ItemsPanelTemplate>
</Application.Resources>并以这种方式将其提供给UIControl
<.... ItemsPanel="{StaticResource mycustomItemsPanel}" />但我知道这可以作为
<.... ItemsPanel="Binding Source={StaticResource mycustomItemsPanel}}" />它们之间的区别是什么?
发布于 2012-07-30 17:32:03
一方面,绑定只能在dependency properties上进行,另一方面,当一些对象被指定为Binding.Source时,也就是DataSourceProviders,表现会有所不同。
DataSourceProvider对象的
公共基类和约定,它们是执行某些查询以生成单个对象或可用作绑定源对象的对象列表的工厂。
然后使用由DataSourceProvider提供的对象,而不是DataSourceProvider本身。
因此,在这种特定情况下,应该没有实际差异。
https://stackoverflow.com/questions/11718684
复制相似问题