代码说明了一切...不确定这里发生了什么... ItemsSource绑定工作正常(单向或双向)
public MyView()
{
InitializeComponent();
this.WhenActivated(disposableRegistration =>
{
// TODO - Why do I have to do the binding this way?
BindingOperations.SetBinding(TreeListControl, DataControlBase.CurrentItemProperty, new Binding
{
Path = new PropertyPath("CurrentSelectedItem"),
Source = ViewModel
});
// TODO - why does this not work? (need the code above)
//this.Bind(ViewModel,
// viewModel => viewModel.CurrentSelectedItem,
// view => view.TreeListControl.CurrentItem)
// .DisposeWith(disposableRegistration);
this.OneWayBind(ViewModel,
viewModel => viewModel.Root,
view => view.TreeListControl.ItemsSource)
.DisposeWith(disposableRegistration);
}
}
有人知道吗? MyView是ReactiveUserControl,而MyViewViewModel是ReactiveObject。