无UI如何使用WhenAny使用两个属性? [英] Reactive UI how to use WhenAny using two properties?
本文介绍了无UI如何使用WhenAny使用两个属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用WhenAny(无UI)的第一次。
I am trying to use WhenAny (Reactive UI) for the first time.
在一个标识符==XYZ和IsMax场得到改变,要在本地值设置为true的订阅,
When a Identifier =="xyz" and a IsMax field get changes, want to set a local value to true in the subscribe,
this.WhenAny(x => x.IsMax, x => x.Value)
.Subscribe(x =>
{
if (Identifier == "xyz")
{
isOk = true;
}
});
但有合并标识符状况以及任何其他方式?
but is there any other way to merge Identifier condition as well?
推荐答案
我不熟悉ReactiveUI,但如果使用相同的IObservable的反应扩展,那么你可以这样做:
I'm not familiar with ReactiveUI, but if it uses the same IObservable as Reactive Extensions, then you could do this:
this.WhenAny(x => x.IsMax, x => x.Value)
.Where(_ => Identifier == "xyz")
.Subscribe(_ =>
{
isOk = true;
});
这是你想要的?
Is this what you wanted?
PS:我应该在注释中问这个,但我没有足够的声誉呢。
PS.: I should have asked this in a comment, but I haven't got enough reputation yet.
这篇关于无UI如何使用WhenAny使用两个属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文