locked
Snapped view: how can I make my app fullscreen again? RRS feed

  • Question

  • HI

    When using the snapped view, I want to make my app fullscreen again if someone is selecting something.

    How can I do that?

    THanks

    James

    Wednesday, October 24, 2012 7:35 AM

Answers

  • See this:

      void ShowCurrentViewState() 
            { 
                this.UpdateUnsnapButtonState(); 
     
                // Query for the current view state 
                ApplicationViewState currentState = Windows.UI.ViewManagement.ApplicationView.Value; 
     
                // Assign text according to view state 
                if (currentState == ApplicationViewState.Snapped) 
                { 
                    Scenario1OutputText.Text = "This app is snapped."; 
                } 
                else if (currentState == ApplicationViewState.Filled) 
                { 
                    Scenario1OutputText.Text = "This app is in the fill state."; 
                } 
                else if (currentState == ApplicationViewState.FullScreenLandscape) 
                { 
                    Scenario1OutputText.Text = "This app is full-screen landscape."; 
                } 
                else if (currentState == ApplicationViewState.FullScreenPortrait) 
                { 
                    Scenario1OutputText.Text = "This app is full-screen portrait."; 
                } 
            } 
     
            public void OnSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs args) 
            { 
                switch (Windows.UI.ViewManagement.ApplicationView.Value) 
                { 
                    case Windows.UI.ViewManagement.ApplicationViewState.Filled: 
                        VisualStateManager.GoToState(this, "Fill", false); 
                        break; 
                    case Windows.UI.ViewManagement.ApplicationViewState.FullScreenLandscape: 
                        VisualStateManager.GoToState(this, "Full", false); 
                        break; 
                    case Windows.UI.ViewManagement.ApplicationViewState.Snapped: 
                        VisualStateManager.GoToState(this, "Snapped", false); 
                        break; 
                    case Windows.UI.ViewManagement.ApplicationViewState.FullScreenPortrait: 
                        VisualStateManager.GoToState(this, "Portrait", false); 
                        break; 
                    default: 
                        break; 
                } 
     
                this.ShowCurrentViewState(); 
            } 
     

    this is from: Snap sample



    Sara Silva
    My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    (If my reply answers your question, please propose it as an answer because it will help other users)

    • Marked as answer by Jesse Jiang Wednesday, October 31, 2012 6:41 AM
    Wednesday, October 24, 2012 8:50 AM

All replies

  • You can not, is the user how define if the application is in FullScreen, Filled, Snap or Portrait. You only need to use the Visual State Manager to prevente the bevahior for each view state.

    Sara Silva
    My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    (If my reply answers your question, please propose it as an answer because it will help other users)

    Wednesday, October 24, 2012 7:42 AM
  • Hm it is possible:

    ApplicationView.TryUnsnap();

    • Edited by WickedSick Wednesday, October 24, 2012 7:52 AM
    Wednesday, October 24, 2012 7:51 AM
  • Ok, you are right :)

    I found it:

    How to cancel snap mode programmatically?

    Use of Applications and Snaps Applications in Windows 8

    You should use this:

    ApplicationView class > TryUnsnap | tryUnsnap method

    Attempts to unsnap a previously snapped app. This call will only succeed when the app is running in the foreground.


    Sara Silva
    My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    (If my reply answers your question, please propose it as an answer because it will help other users)


    • Edited by saramgsilva Wednesday, October 24, 2012 7:56 AM
    Wednesday, October 24, 2012 7:56 AM
  • Thanks!

    One question though, is it possible to be notified by an event by Code (C#) if the app gets snapped?

    Wednesday, October 24, 2012 8:07 AM
  • See this:

      void ShowCurrentViewState() 
            { 
                this.UpdateUnsnapButtonState(); 
     
                // Query for the current view state 
                ApplicationViewState currentState = Windows.UI.ViewManagement.ApplicationView.Value; 
     
                // Assign text according to view state 
                if (currentState == ApplicationViewState.Snapped) 
                { 
                    Scenario1OutputText.Text = "This app is snapped."; 
                } 
                else if (currentState == ApplicationViewState.Filled) 
                { 
                    Scenario1OutputText.Text = "This app is in the fill state."; 
                } 
                else if (currentState == ApplicationViewState.FullScreenLandscape) 
                { 
                    Scenario1OutputText.Text = "This app is full-screen landscape."; 
                } 
                else if (currentState == ApplicationViewState.FullScreenPortrait) 
                { 
                    Scenario1OutputText.Text = "This app is full-screen portrait."; 
                } 
            } 
     
            public void OnSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs args) 
            { 
                switch (Windows.UI.ViewManagement.ApplicationView.Value) 
                { 
                    case Windows.UI.ViewManagement.ApplicationViewState.Filled: 
                        VisualStateManager.GoToState(this, "Fill", false); 
                        break; 
                    case Windows.UI.ViewManagement.ApplicationViewState.FullScreenLandscape: 
                        VisualStateManager.GoToState(this, "Full", false); 
                        break; 
                    case Windows.UI.ViewManagement.ApplicationViewState.Snapped: 
                        VisualStateManager.GoToState(this, "Snapped", false); 
                        break; 
                    case Windows.UI.ViewManagement.ApplicationViewState.FullScreenPortrait: 
                        VisualStateManager.GoToState(this, "Portrait", false); 
                        break; 
                    default: 
                        break; 
                } 
     
                this.ShowCurrentViewState(); 
            } 
     

    this is from: Snap sample



    Sara Silva
    My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    (If my reply answers your question, please propose it as an answer because it will help other users)

    • Marked as answer by Jesse Jiang Wednesday, October 31, 2012 6:41 AM
    Wednesday, October 24, 2012 8:50 AM