compositeCollection DataContext错误警告,重命名问题

时间:2014-01-07 13:08:40

标签: c# wpf data-binding compositecollection

我尝试将ListBox.ItemsSource绑定到包含三个CollectionContainers的CompositeCollection。每个CollectionContainer都绑定到我的ViewModel中的ObservableCollection。

因为CompositeCollection不知道我的DataContext,所以我将Source设置为“Proxy”,它是一个知道我的DataContext的FrameworkElement。

 <CollectionContainer Collection="{Binding DataContext.Dampings, Source={x:Reference Proxy}}" />
 <CollectionContainer Collection="{Binding DataContext.Angles, Source={x:Reference Proxy}}" />
 <CollectionContainer Collection="{Binding DataContext.Selectors, Source={x:Reference Proxy}}" />

这在运行时按预期工作,虽然它确实在设计时在DataContext上显示警告: 无法在“对象”类型的数据上下文中解析属性“DataContext”。

有没有办法解决这个设计时问题,因为重命名不会应用于我的Bindings,因为设计师无法正确解析它们?

0 个答案:

没有答案