Bilal
Bilal

Reputation: 588

How to apply layout constraints to in windows phone 8.1?

How can I apply layout constraints to layout so that it auto adjusts it self for every device like we apply in iOS?
The app I developed leaves blank spaces when I run it on higher size devices.

Upvotes: 0

Views: 67

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21919

There are several techniques you can use. Which is best depends on your app's specific design:

  • Use a fluid control such as GridView or ListView which will expand to fill the available space.

  • Use a relative size layout control such as a Grid to lay things out by percentages.

  • Use Visual States to choose different controls or layouts for different size or aspect ratio screens

  • Use a ViewBox to stretch a layout to fit

Windows 10 adds a few new controls that can help:

  • RelativePanel to specify control locations relative to other controls (on top off, to the left of, etc.)

  • Adaptive triggers to automatically switch Visual States based on window size changes

See Defining layouts and views on MSDN for details and quickstarts.

There were several sessions at Build 2015 which touched on this subject, although more aimed at Windows 10 capabilities than at Windows Phone 8.1

Upvotes: 1

Related Questions