Why to use UriMapping in WP7?
Can someone explain me the meaning of UriMappings in Windows Phone 7 and why to use them? I m开发者_运维问答ean why I will need user friendly uri's in a phone app?
UriMappings are part of the Silverlight 3 navigation framework and since WP7 is a Silverlight 3+ port is supports the same API. You don't "have" to use UriMappings if that doesn't jive with your programmatic zen.
A lot of Silverlight developers come from a web background (ASP, PHP, ASP.Net, et al) and as such a very comfortable with the idea of short, hackable, persistent and structured URLs for navigation. Navigation is really an odd thing on any UI platform (even on Silverlight) and as such enabling developers to be successful in it is really all about giving as many options as possible.
Personally, I choose not to use UriMappings in WP7 apps but have my own mini-navigation framework which resolves page names to XAML URLs. There's an example in my open source NavigationService.GetParseUrlString() method and Pages class.
As a side-note, In future releases of WP7 operating systems and WP7 developer tools it might be possible for the emulator/phone to show a full history of Pages in the Back stack. In Mix10 that was demoed as an internal Microsoft capability. Which means that if you have a meaningful page UriMapping it'll be easier to debug.
精彩评论