#PowerPlatformTip 185: Build Truly Responsive Canvas Apps with Containers - No Fixed Screen Size
TL;DR: Set App layout to Responsive in the app settings (older Studio versions: turn off Scale to fit), then build your screen out of horizontal and vertical layout containers instead of absolute X/Y positions. Size children with FillPortions, reference Parent.Width / Parent.Height and switch layouts with the screen’s Size (from App.SizeBreakpoints) so one screen reflows cleanly across phone, tablet and desktop.
💡 Challenge
Classic canvas apps are built for a fixed canvas (e.g. 1366×768) and rely on a fixed app layout (Scale to fit in older Studio versions), which just stretches the whole screen like an image. On a phone or an ultrawide monitor that looks wrong: controls overlap, whitespace explodes, and text gets tiny or huge. Pinning every control to a hardcoded X, Y, Width and Height makes the app rigid and painful to maintain the moment the viewport changes.
✅ Solution
Switch the app to a responsive model and let a container hierarchy do the layout math:
🔸 Set the app layout to Responsive so Width/Height react to the real device size.
🔸 Compose the screen from layout containers (horizontal and vertical) that automatically distribute space.
🔸 Size children proportionally with FillPortions instead of fixed pixels.
🔸 Use App.SizeBreakpoints to switch layouts between phone, tablet and desktop.
🔧 How It’s Done
-
Set the app layout to Responsive 🔸 Settings > Display > App layout: select Responsive instead of Fixed. This also turns off Lock aspect ratio. In older Studio versions and in Microsoft Learn the same switch is called Scale to fit (turn it Off).
🔸 Now
Screen.WidthandScreen.Heightreturn the actual available size, andParent.Width/Parent.Heightbecome meaningful for layout. -
Start with a vertical container as the screen shell 🔸 Insert a Vertical container, then set its
Width = Parent.WidthandHeight = Parent.Heightso it always fills the screen.🔸 Typical structure: header (fixed height) → body (flexible) → footer (fixed height).
-
Nest horizontal containers for side-by-side areas 🔸 Inside the body, add a Horizontal container for a master/detail split (e.g. a gallery on the left, a form on the right).
🔸 Set the gallery’s
FillPortionsto1and the detail pane’s to2- space is shared 1:2 automatically, no pixel math. -
Drive sizing with container properties, not X/Y 🔸 Children of an auto-layout (horizontal or vertical) container don’t expose
X/Y(a container in manual layout keeps them); you control flow with the container’sLayoutDirection,LayoutAlignItems,LayoutJustifyContent,LayoutGapandLayoutOverflowX/LayoutOverflowY(Horizontal and Vertical Overflow).🔸 For controls that should grow, use
FillPortions; for fixed elements set an explicitWidth/Height. -
Adapt the layout with App.SizeBreakpoints 🔸 The screen’s
Sizeproperty is calculated fromApp.SizeBreakpoints, which defaults to[600, 900, 1200]in tablet/web apps ([1200, 1800, 2400]in phone-format apps). Sizes 1-4 map toScreenSize.Small,Medium,LargeandExtraLarge.🔸 Use the screen’s
Sizein a container’sLayoutDirection, e.g.If(HomeScreen.Size <= ScreenSize.Small, LayoutDirection.Vertical, LayoutDirection.Horizontal)(with your screen’s name), so the master/detail split stacks vertically on a phone and sits side by side on desktop.🔸
Parent.Sizeonly works for a control placed directly on the screen. The master/detail container from step 3 sits inside the body, so thereParentis a container, which has noSize, and the formula shows an error. -
Test across form factors 🔸 While you build, use the size switcher in the Studio footer (for example Small = 600 or Medium = 900 wide): with these presets the canvas follows the sizing formulas and the containers reflow.
🔸 Then save and publish the app, and open it in browser windows and on devices of different sizes. The screen should reflow with no overlap and no manual repositioning.
🎉 Result
A single screen adapts to phone, tablet and desktop widths. Adding or removing a control lets the containers re-flow automatically instead of forcing you to recompute coordinates. Layout logic lives in a few container properties, not hundreds of hardcoded positions.
🌟 Key Advantages
🔸 One app, every device: no separate phone and tablet layouts to maintain.
🔸 No pixel math: FillPortions shares space proportionally.
🔸 Maintainable: insert or reorder controls without breaking positions.
🔸 Adaptive: App.SizeBreakpoints switches layouts at defined widths.
🔸 Cleaner formulas: Parent.Width/Parent.Height replace brittle absolute coordinates.
⚠️ Watch Out
A Responsive and a Fixed app layout (Scale to fit in older Studio versions) are mutually exclusive for the app as a whole: the app mode is one switch, not a per-screen choice. That is separate from the migration itself, which you can do screen by screen (see the FAQ): rebuild and test one screen after the other. Retrofitting an existing pixel-positioned screen usually means rebuilding it inside containers rather than tweaking it, because children of an auto-layout container lose their X/Y properties. Also avoid deeply nesting many containers with heavy galleries: excessive nesting can slow rendering, so keep the tree as flat as the design allows.
🎥 Video Tutorial
🎥 Video Tutorial
🛠️ FAQ
1. Do I have to rebuild my existing app to make it responsive?
Usually the screen you want to make responsive, yes. Switching the app layout to Responsive changes how sizing works, and controls placed inside auto-layout containers lose their X/Y properties, so a pixel-positioned screen is easier to rebuild inside containers than to convert in place. Do it screen by screen.
2. What’s the difference between a horizontal container and the older “group”?
A group is just a visual grouping with no layout behaviour. A layout container actively distributes its children using LayoutDirection, FillPortions, LayoutGap and alignment properties - that’s what makes the content reflow when the size changes.
3. How do I show a different layout on phone vs desktop?
Read the screen’s Size property (calculated from App.SizeBreakpoints, default [600, 900, 1200] in tablet/web apps) to determine a size class, then switch a container’s LayoutDirection or a control’s visibility/FillPortions with an If/Switch. For example, stack master and detail vertically below 600px and place them side by side above it.
4. Can I still use FillPortions and fixed sizes together?
Yes. Give fixed elements (a header bar, an icon) an explicit Height/Width, and let flexible elements use FillPortions to share whatever space remains. That’s the normal pattern for a header/body/footer shell.
🔗 Related Tips
🔸 #PowerPlatformTip 69 - Optimize Loading with Fullscreen Reference: fullscreen sizing of root containers with App.Width/App.Height in a responsive app. This tip adds the container hierarchy and the screen’s Size on top.
🔸 #PowerPlatformTip 130 - Build Apps Faster with YAML: paste ready-made responsive component layouts straight into the canvas.
🔸 #PowerPlatformTip 134 - Optimize Canvas Apps with YAML: review your layout’s YAML with AI for structure and performance.
This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).