ReactiveList和WhenAny

我在ReactiveLists中保存了一些具有ChangeTrackingEnabled = true的检查列表。 我想只在每个列表中至少检查一个项目时启用我的OkCommand。

此外,我还要确保使用有效的字节值填充各种其他属性。

我尝试过以下操作,但它不起作用:

  this.OkCommand = new ReactiveCommand(this.WhenAny( x => x.Property1, x => x.Property1, x => x.Property1, x => x.List1, x => x.List2, x => x.List3, (p1, p2, p3, l1, l2, l3) => { byte tmp; return byte.TryParse(p1.Value, out tmp) && byte.TryParse(p2.Value, out tmp) && byte.TryParse(p3.Value, out tmp) && l1.Value.Any(x => x.IsChecked) && l2.Value.Any(x => x.IsChecked) && l3.Value.Any(x => x.IsChecked); })); 

似乎属性更改通知未传播到WhenAny。 知道我应该做什么吗?

这是在有人设置列表时进行测试,即:

 this.List1 = new ReactiveList(); 

相反,你需要这样的东西:

 this.WhenAnyObservable(x => x.List1.ItemChanged, x => x.List2.ItemChanged) .Where(x => x.PropertyName == "IsChecked") .Select(_ => List1.Any(x => x.IsChecked) && List2.Any(x => x.IsChecked));