C# 将ObservableCollection绑定到ItemsControl
我有关于控制的下一个代码:C# 将ObservableCollection绑定到ItemsControl,c#,.net,wpf,reactiveui,C#,.net,Wpf,Reactiveui,我有关于控制的下一个代码: this.OneWayBind(ViewModel, vm=>vm.RectangleCollection, v=>ItemsControl.Items, value=>value.ToString() WPF上的代码: 当我试图转换为字符串以显示列表中的集合或其他类似文本的内容时,我遇到了下一个错误: 无法根据用法推断方法IReactiveBinding ReactiveUI.PropertyBindingMixins.OneWayBind(此TView、TV
this.OneWayBind(ViewModel,
vm=>vm.RectangleCollection,
v=>ItemsControl.Items,
value=>value.ToString()
WPF上的代码:
当我试图转换为字符串以显示列表中的集合或其他类似文本的内容时,我遇到了下一个错误:
无法根据用法推断方法IReactiveBinding ReactiveUI.PropertyBindingMixins.OneWayBind(此TView、TView模型?、表达式、表达式、函数)
的类型参数。尝试显式指定类型参数
我的收藏
public observeCollection RectangleCollection{get;set;}
=新的ObservableCollection()
{
新的矩形视图模型(){Top=50,Left=150,Height=25,Width=40},
新的矩形视图模型(){Top=75,Left=10,Height=45,Width=300},
};
为什么不在ItemsControl
上使用ItemSource
?v=>ItemsControl。Items
应该是v=>ItemsControl.ItemSource