ReactiveUI双向绑定到DevExpress TreeListControl CurrentItem无效

时间:2018-10-28 19:02:25

标签: c# wpf devexpress reactiveui

代码说明了一切...不确定这里发生了什么... 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。

0 个答案:

没有答案