【发布时间】:2015-10-26 11:42:12
【问题描述】:
快速提问,是否可以像使用传统绑定一样通过编译绑定绑定到资源键?
即 传统装订
<Page.Resources>
<local:DataSource x:Key="Data"/>
<CollectionViewSource x:Name="myColl" Source="{Binding Source={StaticResource Data}, Path=Colleges}" ItemsPath="Campuses" IsSourceGrouped="True"/>
</Page.Resources>
编译绑定
我试过了,我知道它不起作用,显然它是在页面上寻找属性“数据”而不是资源。
<Page.Resources>
<local:DataSource x:Key="Data"/>
<CollectionViewSource x:Name="myColl" Source="{x:Bind Data.Colleges}" ItemsPath="Campuses" IsSourceGrouped="True"/>
</Page.Resources>
那么还有其他方法吗?
【问题讨论】: