Forum Xamarin.Android

[clarification] Regarding MVVMLight WhenSourceChanges.

Pedro_MonizPedro_Moniz Member ✭✭
edited April 2019 in Xamarin.Android

So I have some doubts regarding a certain behavior and I would like to know the best practice regarding this.

I have a simple bind on OnViewCreated.

_bindings.Add(this.SetBinding(() => _viewModel.VariableX).WhenSourceChanges(() =>
{
MethodY();
}));

And everything is good, but I have an issue which is regarding the MethodY.
When I create the bind, MethodY is called but I only want to call it when VariableX changes, not on bind declaration.

I can solve my issue with a local variable and an if, but should I really have to to that?

Sign In or Register to comment.