Search code examples
c#xamluwpautoresize

Resizable views UWP


How do I make it so that a desktop UWP app will resize based on resolution? Mainly I need it to work between a surface pro and a Surface Studio. I've researched around google and I haven't seen anything that goes into detail. I know of things like RelativePanel and VisualStateManagers, but I have not clue how to use them. Any guidance would be much appreciated.


Solution

  • Use Grids to Place your elements. Specify the row height and column width as fractions (0.2*,0.2*,0.6*) so that it adds upto 1 (not necessarily, but for convenience). Then your UI will scale automatically based on resolution. You don't even have to use relative layouts. Just place them within these Grids. If you want complex actions, go with VisualStateManagers.