问题
I am trying to use WhenAny (Reactive UI) for the first time.
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?
回答1:
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.: I should have asked this in a comment, but I haven't got enough reputation yet.
来源:https://stackoverflow.com/questions/28804765/reactive-ui-how-to-use-whenany-using-two-properties