1
在windows phone 7樞紐控制模板項目中,如果您從特定數據透視項目轉到搜索頁面並在手機上選擇返回,則透視控制頁面不會記住所選項目。它總是回到樞軸控制的第一項。WP7 pivotcontrol記住所選項目
你如何改變這種行爲,所以如果你在第三個樞軸項目,你去搜索和回擊,你回到第三個樞軸項目。
PRATIK
在windows phone 7樞紐控制模板項目中,如果您從特定數據透視項目轉到搜索頁面並在手機上選擇返回,則透視控制頁面不會記住所選項目。它總是回到樞軸控制的第一項。WP7 pivotcontrol記住所選項目
你如何改變這種行爲,所以如果你在第三個樞軸項目,你去搜索和回擊,你回到第三個樞軸項目。
PRATIK
當你按下搜索按鈕,您的應用程序邏輯刪除(換句話說,應用程序停止並保存在內存中,只要有可能)。它是完全由你(開發商)將如何處理它。該系統本身只做了幾件事情來獲得最後一次返回狀態 - 就像導航到最後一頁。 你可以在瀏覽器中將它想像成cookies。如果您按下後退按鈕,瀏覽器將檢查cookie是否存在,並使用cookie中的信息加載內容。
有幾種方法可以處理它併爲用戶提供最好的用戶體驗。您可以將狀態保存到State集合或直接保存到IsolatedStorage。在App.xaml.cs
使用事件// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
}
// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}
// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
}
或事件爲您的網頁與樞軸
// set state
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
#if DEBUG
Debug.WriteLine("TOMBSTONING EVENT: OnNavigatedFrom at {0}", DateTime.Now.ToLongTimeString());
#endif
//try to locate state if exists
if (State.ContainsKey(App.STATE_KEY))
{
//clear prev value
State.Remove(App.STATE_KEY);
}
State.Add(App.STATE_KEY, this.State);
base.OnNavigatedFrom(e);
}
// get state
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
// try to locate the state from previous run
if (State.ContainsKey(App.STATE_KEY))
{
// return previous state
var s = State[App.STATE_KEY] as Info;
if (s != null)
{
#if DEBUG
Debug.WriteLine("TOMBSTONING EVENT: OnNavigatedTo at {0}", DateTime.Now.ToLongTimeString());
#endif
this.State = s;
}
}
base.OnNavigatedTo(e);
}
使用這個模式來與樞軸您的網頁並保存您的轉動控制的最後一個索引。嘗試和捕捉塊也會很好。