Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8477737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:32:47+00:00 2026-06-10T18:32:47+00:00

In Windows 8 when the view state changes from snapped to filled to full

  • 0

In Windows 8 when the view state changes from snapped to filled to full screen;

How can I catch these events and respond to them with WinJs ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:32:49+00:00Added an answer on June 10, 2026 at 6:32 pm

    See this blog post on how to catch view state changes. Basically the recommendation boils down to catching the resize event and then checking the view state like this:

     window.addEventListener("resize", onResize);
    
    
    function onResize() { 
        // Update view for the new window size 
        updateView(); 
    } 
    
    function updateView() { 
        // Query for the current view state 
        var myViewState = Windows.UI.ViewManagement.ApplicationView.value; 
    
        var viewStates = Windows.UI.ViewManagement.ApplicationViewState; 
        var statusText; 
    
        // Assign text according to view state 
        switch (myViewState) { 
            case viewStates.snapped: 
                statusText = "This app is snapped!"; 
                break; 
            case viewStates.filled: 
                statusText = "This app is in filled state!"; 
                break; 
            case viewStates.fullScreenLandscape: 
                statusText = "This app is full screen landscape!"; 
                break; 
            case viewStates.fullScreenPortrait: 
                statusText = "This app is full screen portrait!"; 
                break; 
            default: 
                statusText = "Error: Invalid view state returned."; 
                break; 
        }
    

    If you look in the Microsoft Visual Studio Express 2012 RC for Windows 8 template for Javascript you will see something like this in navigator.js:

    window.onresize = this._resized.bind(this);
    
    _resized: function(args) {
        if (this.pageControl && this.pageControl.updateLayout) {
            this.pageControl.updateLayout.call(this.pageControl, this.pageElement, appView.value, this.lastViewstate);
        }
        this.lastViewstate = appView.value;
    },
    
    //*page*.js
    
    updateLayout: function (element, viewState, lastViewState) {
         /// <param name="element" domElement="true" />
         var listView = element.querySelector(".itemslist").winControl;
         if (lastViewState !== viewState) {
              if (lastViewState === appViewState.snapped || viewState === appViewState.snapped) {
                   var handler = function (e) {
                   listView.removeEventListener("contentanimating", handler, false);
                   e.preventDefault();
              }
              listView.addEventListener("contentanimating", handler, false);
              var firstVisible = listView.indexOfFirstVisible;
              this._initializeLayout(listView, viewState);
              if (firstVisible >= 0 && listView.itemDataSource.list.length > 0) {
                    listView.indexOfFirstVisible = firstVisible;
               }
           }
       }
    },
    
    _initializeLayout: function (listView, viewState) {
    
        if (viewState === appViewState.snapped) {
            listView.layout = new ui.ListLayout();
        } else {
            listView.layout = new ui.GridLayout();
        }
    },
    

    According to this msdn page you can also use media queries when view state changes affect the CSS properties or layout specified in the CSS. For all other changes onResize should be used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows form and user select cloth parameters from comboboxes like country-state-city
We've got a bunch of data the users may want to view windows of
I want to view the nfs shares that are exported on a windows server
I have a Windows Azure Virtual Machine. I am able to view my ASP.Net
I am learning to develop windows forms application with Entity Framework using Model View
I was looking to using the Twitter Bootstrap Modal windows as a partial view.
When using the Event Viewer in Windows 7, there is a separate 'XML View'
iHi, in my Windows Phone application in View I have: <TextBlock x:Name=lblink FontSize=15 Margin=30,0,24,0
The code under test follows. view.QueryResultsGrid is a System.Windows.Forms.DataGridView object: public void SelectCheckedChanged(object sender,
I'm trying to build a pipeline with gst-launch in Windows 7 that will view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.