javascript - Switching from GridView to ListView when Windows Store app is snapped -


i trying change layout of listview control "gridview" "listview" when application gets snapped. of course, should return "gridview" in other state. wrote code, doesn't work, wonder why...

this code i've written:

var viewstate = windows.ui.viewmanagement.applicationview; var list = document.getelementbyid("messagedisplay").wincontrol; if (viewstate == windows.ui.viewmanagement.applicationviewstate.snapped) {     list.layout = new winjs.ui.listlayout(); } else {     list.layout = new winjs.ui.gridlayout(); } 

as taken here listen resize event , make changes listview's layout property.

i can't tell wher ein code calling similar code, here entire method you'll need

 window.addeventlistener("resize", function (e) {     var currentviewstate = windows.ui.viewmanagement.applicationview.value;     var snapped = windows.ui.viewmanagement.applicationviewstate.snapped;      if (currentviewstate === snapped) {         that.listview.layout = new winjs.ui.listlayout();      }     else if (lastviewstate === snapped && currentviewstate !== snapped) {         that.listview.layout = new winjs.ui.gridlayout();     }      lastviewstate = currentviewstate; });  

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -