简体   繁体   中英

Too much xaml makes my wp7 page load slowly

I'm having a huge load time for the MainPage of my app, and I am pinning it down to pretty much the amount of Xaml and c# code that has to be read for this page alone.

I literally have about 25000 lines of xaml code (some 100 animations along with grids, stackpanels, etc) and about 33000 lines of c# codebehind for my app on this page alone.

No external http calls or parsing is done on this page. All assets and such are in the same .dll. I've bitmapcached my images, marked them as content, and have set CreateOptions as "BackgroundCreation".

However the only surefire way to make the app load quickly is to condense my xaml in any way possible. Simply deleting my animations makes my page load 2 seconds faster.

The load time is roughly 6-8 seconds for this page, and I was wondering if there is any way that I can go about making my MainPage load more quickly. Are there any tips that I may not know about?

I think definitely the way to go for you is to start looking for controls, data and logic that appear together and extract some sort of smaller pieces you can work with. You can use the PhoneApplicationFrame to display a page within a page. You can also take a look on this tutorial explaining how to take advantage of the built in navigation service

The MVVM pattern surely is the nicest way to do XAML development, but it may be a little bit hard to grasp if you have just started out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM