2014-01-15 51 views
1

我正在開發一個登錄屏幕,用戶需要在其中介紹他們的數據,然後提交它們。wp8彈出的鍵盤重疊

我曾經考慮過:我曾考慮過使用Page,但最終我拒絕了這個想法,因爲如果我在MainPage之前放置了Login頁面,那麼如果我從MainPage返回,那麼它將轉到Login頁面,不是我想要的。如果登錄頁面位於MainPage之後,那麼如果我第一次執行應用程序而不登錄,如果我按回來,那麼它將轉到MainPage,我不想要它。

問題:我決定最終使用Popup。目前看起來很完美,但是當我想使用文本框時,鍵盤會重疊該文本框,而我想要的是像往常一樣向上移動彈出窗口。我不知道這是否可能,否則我願意聽取一些替代方案。

預先感謝您。

+0

好吧,如果您使用頁面,您可以從導航服務中刪除後退條目。是否要僅顯示登錄頁面? –

+0

理想的情況如下:我在開始時登錄頁面,然後一旦登錄,它將導航到MainPage。一旦在MainPage中,當用戶按下返回鍵時,應用程序將關閉而不導航到登錄頁面。 – programmer23

+0

我明白了,讓我告訴你我的想法 –

回答

1

WMAppManifest.xml刪除屬性Navigation Page和你App.xaml.cs你有這樣的:

private void Application_Launching(object sender, LaunchingEventArgs e) 
     { 
      LoadDefautPage(); 
     } 

void LoadDefautPage() 
     { 
     if (StartForFirstTime)//tombstone local variable 
      { 
       if (!IsLoggedIn)//flag save it in IsolatedStorageSettings 
       { 
        RootFrame.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative)); 
       } 
       else 
       { 
        RootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); 
       } 
       StartForFirstTime = false; 
      } 
     } 

最後取出回到的MainPage項:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) 
     {  
      while (this.NavigationService.CanGoBack) 
      { 
       this.NavigationService.RemoveBackEntry(); 
      } 
     } 

這只是一個想法,讓我知道如何它(():

+1

非常感謝。您的解決方案已解決我的問題:)。 – programmer23