How combine multiple visibility properties binding (fluent) in MvvmCross for iOS?

581 Views Asked by At

i want to combine these 2 properties:

set.Bind(myObject).For("Visibility").To(vm => vm.property1).WithConversion("Visibility");
set.Bind(myObject).For("Visibility").To(vm => vm.property2).WithConversion("Visibility");

I read something like this for Android

local:MvxBind="Visibility Visibility(And(property1, property2))"

But don't know how to translate to fluent, how can i do?

1

There are 1 best solutions below

0
On BEST ANSWER

There are at least two ways to do it:

set.Bind(textField)
   .For(t => t.Hidden)
   .To($"{nameof(FooViewModel.property1)} && {nameof(FooViewModel.property2)}");

and

set.Bind(textField)
   .For(t => t.Hidden)
   .ByCombining("And", vm => vm.property1, vm => vm.property2);

In the second example the register of And keyword is important.

Both options give the same result: textField will be hidden only if both property1 and property2 are equal true