Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

syncfusion - Lifetime of visual elements on a page in a xamarin.forms.shell framework

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

We have analyzed the query and we would like to inform that not only Maps controls, simple ContentPage also act like this. It destructs the old pages and re-creates the pages view while come back in navigation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...