我公司拥有一批在举行核对清单的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);
}));
Run Code Online (Sandbox Code Playgroud)
似乎属性更改通知未传播到WhenAny.知道我应该做什么吗?
这是在有人设置列表时进行测试,即:
this.List1 = new ReactiveList<Foo>();
Run Code Online (Sandbox Code Playgroud)
相反,你需要这样的东西:
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));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2176 次 |
| 最近记录: |