问题
I was wondering about the implementation of an In-App Home Button that takes you back from any Page to the MainPage. As far as I remember this is not allowed by the WP7 Development Guidelines. But I can't find any written Information about that.
Does anyone know where this is written?
回答1:
Home button is generally discouraged, msdn source:
Placing a Home button in your user interface deviates from the Windows Phone navigation model.
Implementing a Home button in your app may also cause a second issue, one that has a much more severe implications for your app: it might inadvertently create a scenario where a user can get stuck in an infinite (or near infinite) loop when he or she uses both your Home button and the hardware Back button to navigate. This loop may get worse if they use the Back button to move from one app back through your app just to get to another. Ensure that these issues don’t affect your app.
However, try to keep the architecture of your app as shallow as possible, and make use of lists and pivots so that the user can navigate back to the landing screen with few steps back and from there to previous launched apps.
But there will be applications that cannot have shallow navigation and require a home button, for example google drive or dropbox folders browser - after going deep in the folder structure user will want to quickly navigate to main page. Guidelines, msdn source:
If your app lets users pin pages, consider whether a home button is required to let the user get back to the root of the app quickly. A home button navigates to the home page of the app and then clears the entire navigation back stack.
For example, if the pinned page is a shopping cart, the user may want to complete the purchases in the shopping cart and then start shopping again. In this case, giving the user a home button improves the user experience by reducing the number of taps they need to get back to the start of the app.
In your MainPage:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
while (NavigationService.BackStack.Any())
NavigationService.RemoveBackEntry();
base.OnNavigatedTo(e);
}
回答2:
It's permitted but not recommended. As a general rule you should rely on the back button for navigation to return to the main page.
If you do want to implement this behaviour you should test carefully with actual users who are familiar with the phone. Don't invalidate your UX test by having users who aren't familiar with the phone. Your actual users will be and will expect your app to follow the conventions of the native apps and almost all others.
If you do need to implement this you will probably want to use the NonLinear Navigation Service to correctly manage the back button behaviour.
回答3:
I don't think it is disallowed, however, doing this could cause navigation loops that will annoy the user when he / she tries to exit your app using the back button.
For instance, imagine an app with 3 pages, A, B & C. Say page C contains a 'home' button to get back to page A directly. So your navigation stack may end up looking like this:
A -> B -> C -> A -> B -> C -> A ....
That requires a lot of back button presses to get the user back to the start page and exit the app. There are a few ways to avoid this, the most obvious, of course, being, do not provide a 'home' button. But if you decide that is a must-have for your app, you can
Use the non-linear navigation service to manage the circular navigation
Use a more naive method where you maintain a global flag, when the user presses the home button set this flag and call
NavigationService.GoBack()
. Override theOnNavigatedTo
method on each page and if this global flag is set callNavigationService.GoBack()
again until you get to the main page.
回答4:
i believe it is allowed as long as the back button navigation goes back to the last visible page.
来源:https://stackoverflow.com/questions/6361490/in-app-home-button-to-navigate-to-mainpage-allowed