I have an iOS project on Xamarin and use bindings to storyboard labels and other controls.
For example like this:
// binding #1
_bindings.Add(this.SetBinding(() => this.ViewModel.MyProperty, BindingMode.OneWay).WhenSourceChanges(this.MyCallback));
// binding #2
_bindings.Add(this.SetBinding(() => this.ViewModel.MyProperty, () => this.label1.Text));
// binding #3
_bindings.Add(this.SetBinding(() => this.ViewModel.MyProperty2, () => this.label2.Text));
// binding #4
_bindings.Add(this.SetBinding(() => this.ViewModel.MyProperty3, () => this.label3.Text));_
ViewModel implements INotifyPropertyChanged interface. Changing of MyProperty
raises PropertyChanged event.
The problem is that this.MyCallback
method called 4 times. Exactly the same number of times as many I have bindings. If I leave the only one binding with WhenSourceChanges the method
will be called one time. If I add another one, it will be called 5 times. One time for each added binding.
I've created the quite simple sample iOS project that reproduces this issue and attached it to this post. You can set breakpoint into callback method and make sure that it called multiply times.
Could you please investigate what the problem and fix it in next release?
Please, let me know if you have any questions. Thank you!