UWP 开发APP准备工作
2015-11-28 20:11
399 查看
每新建一个UWP之后,都要进行一番相同的处理步骤,才能使Mobile的使用体验更好,故总结如下:
1.订阅Mobile后退导航事件
在App.xaml.cs文件中OnLaunched方法中添加
响应后退导航按钮
2.增加PC端的后退按钮
3.页面跳转时的缓存
1.订阅Mobile后退导航事件
在App.xaml.cs文件中OnLaunched方法中添加
SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
响应后退导航按钮
private void App_BackRequested(object sender, BackRequestedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) return; // Navigate back if possible, and if the event has not // already been handled . if (rootFrame.CanGoBack && e.Handled == false) { e.Handled = true; rootFrame.GoBack(); } }
2.增加PC端的后退按钮
protected override void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame.CanGoBack) { // If we have pages in our in-app backstack and have opted in to showing back, do so SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } else { // Remove the UI from the title bar if there are no pages in our in-app back stack SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } }
3.页面跳转时的缓存
NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required;
相关文章推荐
- 如何让iOS 保持界面流畅?这些技巧你知道吗
- [转]用android LinearLayout和RelativeLayout实现精确布局
- Apple TV编程指南:资源管理
- ios crash log查看
- 【IOS】IOS OpenCV之HelloWorld
- android动画
- Android调用系统相机方法及保存照片方式
- Android中listView中用于下载、显示图片
- app创建技巧
- android的IPC机制
- Error:Execution failed for task ':myapp:dexDebug'. com.android.ide.common.process.ProcessExcepti
- iOS开发51-iOS Mac OS X Adium的使用
- 手机点击QQ直接跳转
- Android地图开发 安全码生成
- .net web api ioc unity usage
- Android Calendar的学习与运用
- 让android定时关机的实现方法
- android Gson的使用
- iOS开发50-iOS Mac OS X Spark的使用
- 南通大学教务管理系统微信公众号的缺点