Windows 8 will be running on everything from large 30 inch (or bigger) PC monitors down to tablets that could have 10 inch (or smaller) screens. That means the creators of Metro apps must be aware that their software will be viewed in a variety of different sizes. The "snap" feature for Windows 8 also allows two Metro apps to be on the screen at the same time. Those same apps can also be viewed in portrait or landscape modes.
In the latest entry on the official Windows 8 app developers blog, Microsoft's Chris Jones offers some help to Metro app makers on how to make sure they look and operate well with difference sizes and states.
The highly technical blog entry offers up some example code that Metro app developers can use for having their software react to different screen ratios. Jones says:
The basic pattern for handling screen resize and view state changes is the same for Windows 8 apps written in XAML and in HTML: simply attach callback functions to the appropriate events that the respective frameworks provide, and query for any additional necessary info.
An app creator might want to include images that will scale up or down depending on the app's screen size or state. Jones says that Metro app makers need to make sure the ratio of the images are correct. He says:
In snapped mode, you might want to download a small image to tile in the background, and in filled mode, you might want a standard 4:3 aspect ratio image, or a 16:9 aspect ratio image in fullscreen-landscape mode. In addition, depending on the height of the screen, you might want to select different image resolutions for each aspect ratio.
Jones adds that if app makers follow the advice and the example code in the blog, they should see that the app's code will work correctly no matter how big or small the app appears on screen or in what state it is in.
Image via Microsoft