What happens to the visual elements on a contentpage, in a shell-application, when you navigate to another page?
The specific pages, seem to remain alive, judging by the constructors only being called on first display and not when subsequently navigating back to the page again, but it seems that some/all the visual elements on a contentpage are refreshed when navigating back to the page.
This is specifically something I see when placing a forms.map or syncfusion.sfmap on a page, and navigating away from the page and then back. The maps obviously reset to initial values, on reload, so they are apparently killed off and recreated. Making a custom renderer for a map shows OnElementChanged being called on reloading, also indicating that it was not "just kept on hand" for when the page would reload.
It seems that the forms classes, encapsulating the deeper controls, do persist, but they disconnect from the lower level controls, and reloads them when becoming visible again? I am somewhat new to mobile development, and may or may not miss the entire point here...
The real question is if I can avoid that behavior. I have a shell app with various pages containing maps. Those maps are populated with various graphics objects and are being panned and zoomed, so it is a real pain to have them reset when briefly moving away from a page. Is there a way to avoid that, so they just quickly pop back to life when the page is displayed again?
question from:
https://stackoverflow.com/questions/65647327/lifetime-of-visual-elements-on-a-page-in-a-xamarin-forms-shell-framework 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…