How to handle various view states in Windows 8.1 store app -
i have windows 8.0 code , had handled ui viewstates portrait,landscape, filled , snapped. windows 8.1 viewer can move app size. how handle ui in case. doing this.
private void questionpage_sizechanged(object sender, sizechangedeventargs e) { applicationviewstate currentstate = windows.ui.viewmanagement.applicationview.value; if (currentstate.equals(applicationviewstate.snapped)) { visualstatemanager.gotostate(this, "snapped", false); } else if (currentstate.equals(applicationviewstate.fullscreenlandscape)) { visualstatemanager.gotostate(this, "fullscreenlandscape", false); } else if (currentstate.equals(applicationviewstate.filled)) { visualstatemanager.gotostate(this, "filled", false); } else if (currentstate.equals(applicationviewstate.fullscreenportrait)) { visualstatemanager.gotostate(this, "fullscreenportrait", false); } }
firstly, need decide how categorize sizes. decided go following:
default - landscape full screen.
portrait - portrait full screen.
small - snapped/resized 500 - 683 wide, vertical orientation
medium - snapped/resized 684 wide , above, vertical orientation
so basically, small , medium sizes vertical layout, height bigger width. when medium width becomes larger height, default landscape size.
we use:displayorientations currentorientation = windows.graphics.display.displayinformation.getforcurrentview().currentorientation;
instead of applicationviewstate
sizechangedeventargs
.
then define sizes follows:
//small size if (e.newsize.width <= 683 && (currentorientation == displayorientations.landscape || currentorientation == displayorientations.landscapeflipped || currentorientation == displayorientations.none))
you can play , define ever sizes like.
Comments
Post a Comment