2016-07-18 5 views
0

Folowing、Windowsの携帯電話に押されたときに閉じるからContentDialogを防ぐためにどのように私はバックキー が押されたときに失われないために使用しています私のコードである、しかし、それはまた、「ブロッキング「はい」とされます コンテンツダイアログの「いいえ」ボタンをクリックします。何が理由だろうか?**は、ホームキーは8.1

dialog = new ContentDialog() 
       { 
        Title = "One basta found", 
          //RequestedTheme = ElementTheme.Dark, 
          //FullSizeDesired = true, 
          MaxWidth = this.ActualWidth // Required for Mobile! 
         }; 

         // Setup Content 
         var panel = new StackPanel(); 

         panel.Children.Add(new TextBlock 
         { 
          Text = file.Name+" is found. Do you want to add it?", 
          TextWrapping = TextWrapping.Wrap, 
         }); 


         dialog.Content = panel;      
         // Add Buttons 
         dialog.PrimaryButtonText = "Yes"; 
         dialog.IsPrimaryButtonEnabled = true; 

dialog.Closing += ContentDialog_Closing; 
void ContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args) 
      {    
        args.Cancel = true;    
      } 

答えて

0

を、私はあなたが後に戻って、ホーム画面からアプリケーションへのオープンコンテンツダイアログを持ちたい、正しく理解していれば。おそらく少しの回避策を試すべきです。 onNavigatedFromでは、コンテンツダイアログが開いている場合は情報を保存し、onNavigatedではこれをチェックしてコンテンツダイアログを再度表示します。

override OnNavigatedTo(...){ 
    if(this.contentDialogShouldBeOpen){ 
     OpenContentDialog(); 
    } 
} 

override OnNavigatedFrom(...){ 
    this.contentDialogShouldBeOpen = isContentDialogOpen; 
} 

のVisual Studioを実行せず

関連する問題