DisplayOrientations.PortraitFlipped:<\/span> the application is in portrait mode: the other portrait \ud83d\ude09<\/li>\n<\/ol>\nHow to get the layout state and its changes ?<\/h3>\n
This time, you have to use the ApplicationLayout class. It exposes a GetForCurrentView method which gives you the instance regarding the current view. This instance exposes then an event named LayoutChanged. You can then subscribe to it to be notified of the changes of the layout of the application.<\/p>\n
Here is an example:<\/p>\n
[csharp]private void Page_Loaded(object sender, RoutedEventArgs e)
\n{<\/p>\n
DisplayProperties.OrientationChanged += Page_OrientationChanged;<\/p>\n
if (_displayHandler == null)
\n {
\n _displayHandler = Page_OrientationChanged;
\n _layoutHandler = Page_LayoutChanged;
\n }
\n DisplayProperties.OrientationChanged += _displayHandler;
\n ApplicationLayout.GetForCurrentView().LayoutChanged += Page_LayoutChanged;
\n SetCurrentViewState(this);
\n}
\nprivate void Page_LayoutChanged(object sender, ApplicationLayoutChangedEventArgs e)
\n{
\n \/\/The current layout is …
\n var currentLayout = ApplicationLayout.Value;
\n}
\n[\/csharp]<\/p>\n
There is three layout states :<\/strong><\/p>\n\n- ApplicationLayoutState.FullScreen :<\/span> the application is displayed alone in .. fullscreen mode.<\/li>\n
- ApplicationLayoutState.Filled :<\/span> the application is displayed in ‘splitted mode’ and in the ‘main’ aera.<\/li>\n
- ApplicationLayoutState.Snapped :<\/span> the application is displayed in ‘splitted mode’ and in the ‘small’ aera.<\/li>\n<\/ol>\n
Funny thing: the framework swap the comments for the snapped and full screen mode.<\/em><\/p>\nAs you can have seen, the code is straigthforward and easy to put in place !<\/p>\n
Regards,<\/p>\n","protected":false},"excerpt":{"rendered":"
Metro applications and windows 8 is designed to be runned on a PC. This is even better if this PC is a tablet \ud83d\ude42 (but an eeepc is too small)! If the tablet has the…<\/p>\n","protected":false},"author":3,"featured_media":278,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[20,25,24],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/261"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":19,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":282,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/261\/revisions\/282"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media\/278"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}