简体   繁体   中英

Having done them in Win8, how do I do Split Pages in Windows 8.1?

My team and I have recently migrated our app from Windows 8 to Windows 8.1. It worked fine until I went to update the existing pages and add a new one. Instead of any errors, just nothing happened.

The way I understand it is, in Windows 8, split pages had their information stored in a DataSource class, and I could even put all the stuff for all the split pages into the one class if I wanted to.

It's changed in Windows 8.1, though, so all the content for the pages go into the code behind pages for that actual page.

I can't actually seem to find any examples, articles or anything online on how to do this. Would anyone be able to link me to such an article or explain how the groups and items are meant to go into the class?

Thanks!


Reply to htuomola:

When I tried adding a new split page, at the time I didn't realise that how you put the content into the page is handled differently, so I just went and did the same as before. I admit, it might not be best practice to have done it like this, but at the time I felt it made the most sense. I had all the groups and items for the various split pages in the one data source class, and the individual pages just pointed to which items/groups I wanted. So, not knowing any better, I made an identical split page to the others, and it didn't pick up the new groups/items, but it did find the old ones. The old split pages were working fine at this point too. It was only when I tried to make a new 8.1 style split page, that they all stopped working and threw errors like "The type 'IME.Miscellaneous.Additional.Help' already contains a definition for 'itemDetailGrid'" and ""IMEDataSource" does not exist in the namespace "using:IME.Data".", even though I didn't change the pages that are having these errors - at all.

The Split Page item template still exists with Windows 8.1 applications even if the NavigationHelper and visual state handling code is a bit different. I think it also works pretty nicely out-of-the-box. Did you try adding a new Split Page page to you project, what problems are you facing?

Some documentation that you can find is in MSDN project templates and item templates pages. You should probably find a few samples in MSDN that use the Split Page/App template.

About the information storage, do you mean that in Windows 8.0 there was a separate view model class and 8.1 only has an ObservableDictionary property on code behind? Nothing prevents you from replacing that with a better solution. I'd just delete it and follow MVVM guidelines, setting up a ViewModelLocator and view models.

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