i`m currently trying to build a xamarin forms application containing 2 views.
An OverviewPage and a ImagePage, both in a navigationpage.
The OverviewPage is like a galerie of images and every image can be opened in a imagepage.
You can also go foreward from imagepage to imagepage.
In the ImagePage there is an additional navigation button which redirects you to the overviewpage.
The galerieitems of the overviewpage are from a property of type observablecollection from my viewmodel bound to a listview.
When you take a picture in the imagepage i send a message via messagingcenter from my imagepagemodel to a method in my overviewpagemodel which is adding my taken picture to my observablecollection.
What i'm currently doing is, everytime you click the additional navigationbutton from the imagepage i create a new instance of OverviewPage which gets the updated overviewpagemodel in the constructor with my updated collection.
As long as i use the build-in navigationbutton to step back from imagepage to overviewpage everything works fine.
But when im using my additional navigationbutton which creates a new instance of overviewpage, my message will be subscriped more then once and the new pictures i take will be added once for every instance of overviewpage created because the message is subscripted that much times.
Do i have to pass my one instance of overviewpage from method to method in order to redirect to this one instace every time or how do i solve my problem?
Thank you very much, Gelatto