Classes suddenly passed by reference and binding issues

cbdcbd Member ✭✭

I'm working on my first Xamarin project, using Xamarin.Forms with MVVM structure.
I'm not using Prism or the like but I am using UnityContainer and I'm initially targeting Android.
My App takes in a number of quickly sequenced events triggered by Bluetooth Characteristic Notifications. Data updated in this way is then displayed on a screen in a ListView.
All was working well, but in the last couple of days class instances passed to functions have suddenly started to be passed by reference (so changes made to them for local use within the function now effect their original instance i.e. in the ListView source) and at the same time I'm getting odd binding issues whereby if a number of class instances are updated in quick succession the values of the last instance updated overwrites the others.

The passing by reference for class instances I've circumvented by creating a new instance of the class locally and copying property values over, which is what I expect to happen automatically, but this isn't ideal.

Has anyone seen this before and more importantly any ideas on the cause?

Any help would be much appreciated.

Best Answer

Answers

  • cbdcbd Member ✭✭

    Thanks for that.
    I do know that, but with deadlines looming I've suffered some brain fade this week and cut & paste errors!

    Your comment has put me back on track.

    I had put in place some new code so that when an entry with data of a certain value was manually selected for update I was searching through the list to trigger updates on all other entries of the property value.
    It turns out I wasn't using the result from my searches, but was instead updating parts of the original and passing that!

Sign In or Register to comment.