-
导航历史记录管理,起始导航历史记录是用于一个导航堆栈来管理的。如完成以下导航:MainPage->Page1->Page
2->Page 3,其实就形成了一个如下图的导航堆栈:
所有当按“返回键”时也是按后进先出得原则进行导航,但是思考如下问题:
- 它的原理是什么呢?每个应用程序都有一个RootFrame。当用户导航到该页面时,导航框架会将应用程序的每个页面或PhoneApplicationPage的实例设置为框架的Content,同时RootFrame有一个RootFrame.BackStack。
- 它是怎样去管理和存储这个页面历史记录的呢?RootFrame.BackStack类似一个堆栈的操作,它存储历史记录中的条目(JournalEntry)类型。
-
是否可以去控制和操作这个堆栈呢?当然是可以去控制这个堆栈,如同我们去操作一个堆栈的数据结构一样,它也有Pop(OS进行操作)和Push操作,push是用RootFrame.RemoveBackEntry()来完成的。
// The BackStack property is a collection of JournalEntry objects.
foreach (JournalEntry journalEntry in RootFrame.BackStack.Reverse())
{
historyListBox.Items.Insert(0, i + ": " + journalEntry.Source);
i++;
}
// If RemoveBackEntry is called on an empty back stack, an InvalidOperationException is thrown.
// Check to make sure the BackStack has entries before calling RemoveBackEntry.
if (RootFrame.BackStack.Count() > 0)
RootFrame.RemoveBackEntry();
2. 怎样管理开始页中的磁条?
我们在页面中添加一个checkbox,当选中的时候,此页就洗到开始页中,否则从开始页中取出。
/// <summary>
/// Toggle pinning a Tile for this page on the Start screen.
/// </summary>
private void PinToStartCheckBox_Click(object sender, RoutedEventArgs e)
{
// Try to find a Tile that has this page's URI.
ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(o => o.NavigationUri.ToString().Contains(NavigationService.Source.ToString()));
if (tile == null)
{
// No Tile was found, so add one for this page.
StandardTileData tileData = new StandardTileData { Title = PageTitle.Text };
ShellTile.Create(new Uri(NavigationService.Source.ToString(), UriKind.Relative), tileData);
}
else
{
// A Tile was found, so remove it.
tile.Delete();
}
}
分享到:
相关推荐
Programming windows phone 7 series
构建Windows Phone7应用程序,一般步骤说明,附图。
Windows Phone 7 手机备份程序 HD7 WPHONE HTC
windows phone 7 code
Windows Phone Blog Menu是一个Silverlight导航控件,看起来像Windows Phone 7。 控件中的tiles链接到web站点在你的博客中使用这个控件可以表达你对WP7的喜爱。 Windows Phone Blog Menu is a Silverlight ...
对Windows Phone 7应用程序生命周期的深度剖析,在与硬件进行交互和使用Expression Blend来创建更丰富的用户界面方面提供的建议,这些都有助于你学习创建独特而又实用的Windows Phone 7应用程序。
本书系统论述了Windows Phone 7操作系统的应用开发,全书由浅入深地介绍了Windows Phone 7应用程序开发的各方面知识,分为开发基础篇、开发技术篇和开发实例篇3个部分,从不同的层面进行了阐释。开发基础篇介绍了...
windows phone管理工具用户wp8智能机,只需要将windows phone.exe在PC端运行并连接手机,就可以在PC端浏览操作手机SD卡中的文件。
Windows Phone 7介绍,移动互联网大会资料
智能家居管理平台WindowsPhone客户端程序,可以通过局域网或互联网控制家里的设备系统,包括虚拟的音乐系统、虚拟智能冰箱、虚拟智能门锁。
Windows phone7手写识别程序Windows phone7手写识别程序
全书206页,涵盖了Window Phone 7 开发基础,Silverlight 交互开发和XNA 游戏开发。本文件包含例子,pdf版本,方便在离线的时候学习 以下是本书目录 Window Phone 7 开发基础: 第一章 Windows Phone 7 智能型手机 ...
Silverlight for Windows Phone 7
windows phone 7 自定义 输入法
Windows Phone 7系列示例程序应用程序,入门示例程序,Windows Phone 7学习,WP7系列示例程序。
windows phone 7 最新铃声,喜欢的可以下载用用
Windows Phone WebSocket 例子程序
This book is a gift from the Windows Phone 7 team at Microsoft to the programming community, and I am proud to have been a part of it. Within the pages that follow, I show you the basics of writing ...
《windows phone 7 完美开发征程》光盘上的代码
Windows Phone7是微软重新打造windows mobile品牌之后推出的一款产品。