2013-10-01 30 views
0

嘿,夥計們請幫助列出我的問題,我做了一個應用程序,我必須上傳它在Windows商店,但問題是,它不支持快照視圖。我希望它不應該在快照視圖中工作,當應用程序進入快照視圖時,它只會顯示一條消息「切換到全屏」。請告訴我如何編碼以及在XAML或XAML.cs中編碼的位置。提前致謝。問題與快照查看地鐵應用程序

回答

0

一個可能的解決方案

  1. 創建您將要用於捕捉
  2. 聽,當用戶卡的應用程序,它是引發事件的新頁。
  3. 導航到網頁,其中有「切換至全屏」
  4. 聽當用戶unsnaps
  5. 回到原來的頁面

爲了實現這一目標,其引發的事件,

在OnLaunched事件您App.xaml.cs寫這

Window.Current.SizeChanged += Current_SizeChanged; 

現在的事件句柄[R

void Current_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e) 
    { 
     ApplicationViewState viewState = ApplicationView.Value; 
     if (viewState == ApplicationViewState.Snapped) 
     { 
      //Navigate to the new common snap page 
     }   
     else{ 
       //Write the code to check if the previous state was snapped and then navigate back 
     } 
    } 
+0

哥們可以告訴我更多的細節.. – user2808491

+0

和我得到的邏輯,但在哪裏寫代碼.. – user2808491

0

添加基本頁和替換XAML與此:

<common:LayoutAwarePage 
    x:Name="pageRoot" 
    x:Class="App1.OopsPage" 
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:App1" 
    xmlns:common="using:App1.Common" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 

    <Grid> 
     <!-- Full screen content. --> 
     <Grid x:Name="FullScreenGrid"> 
      <TextBlock>Here is your content.</TextBlock> 
     </Grid> 

     <!-- Snapped view content. --> 
     <Grid x:Name="SnappedViewGrid" Visibility="Collapsed"> 
      <TextBlock>Please go back to full screen :(</TextBlock> 
     </Grid> 

     <VisualStateManager.VisualStateGroups> 

      <!-- Visual states reflect the application's view state --> 
      <VisualStateGroup x:Name="ApplicationViewStates"> 
       <VisualState x:Name="FullScreenLandscape"/> 
       <VisualState x:Name="Filled"/> 
       <VisualState x:Name="FullScreenPortrait" /> 

       <!-- The back button and title have different styles when snapped --> 
       <VisualState x:Name="Snapped"> 
        <Storyboard> 
         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FullScreenGrid" Storyboard.TargetProperty="Visibility"> 
          <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/> 
         </ObjectAnimationUsingKeyFrames> 
         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SnappedViewGrid" Storyboard.TargetProperty="Visibility"> 
          <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/> 
         </ObjectAnimationUsingKeyFrames> 
        </Storyboard> 
       </VisualState> 
      </VisualStateGroup> 
     </VisualStateManager.VisualStateGroups> 
    </Grid> 
</common:LayoutAwarePage> 

確保您的應用命名空間來代替App1,你必須有LayoutAwarePage.cs在常見夾。

相關問題