#PowerPlatformTip 54: 'Use Galleries'
TL;DR: Build data-driven menus from a single Gallery template instead of individual buttons for consistent styling and one-place maintenance.
💡 Challenge
Designing menus in Power Apps with individual buttons leads to inconsistent layouts, tedious styling, and manual updates for each item.
✅ Solution
Leverage the Gallery control to render menu items dynamically from a single data source, ensuring uniform appearance and simplified maintenance.
🔧 How It’s Done
1. Insert a Gallery
🔸 In the toolbar choose Insert > Gallery > Blank Vertical.
🔸 Position it where you want your menu to appear.
2. Set the Items property
🔸 Define a collection or table, e.g.
ClearCollect(MenuItems,
{Icon: Icon.Home, Label: "Home", Screen: HomeScreen},
{Icon: Icon.Settings, Label: "Settings", Screen: SettingsScreen},
{Icon: Icon.Help, Label: "Help", Screen: HelpScreen}
);
🔸 Set Gallery.Items = MenuItems.
3. Design the template
🔸 Inside the gallery, add an Icon control and set Icon = ThisItem.Icon.
🔸 Add a Label control and set Text = ThisItem.Label.
🔸 Set the gallery’s TemplateFill property to If(ThisItem.IsSelected, LightCyan, White) to highlight the selected row.
🔸 Apply theme colors and spacing for a polished look.
4. Configure navigation
🔸 Select the template and set OnSelect = Navigate(ThisItem.Screen, ScreenTransition.Fade).
5. Maintain your menu
🔸 To add or remove items, update the MenuItems data source or collection.
🔸 Changes appear instantly without modifying multiple controls.
🎉 Result
A dynamic, data-driven menu that keeps consistent styling, scales easily with new items, and improves the user experience.
🌟 Key Advantages
🔸 Consistency across all menu items with a single template
🔸 Flexibility to add, remove, or reorder entries by updating the data source
🔸 Simplified maintenance and fewer controls to manage
🛠️ FAQ
Q: What is the advantage of using a Gallery over individual buttons?
A Gallery lets you define a single layout template and data-bind it, providing uniform styling and centralized maintenance for all menu entries.
Q: Can I use images or custom icons in a gallery?
Yes. Add image controls inside the gallery template and set their Image or Icon property to a URL or icon constant from your data source.
Q: Does using a Gallery affect performance?
Galleries support virtualization for large data sets. For typical menu sizes (5-10 items), performance is excellent and simplifies your app’s logic.
🔗 Related Tips
🔸 #PowerPlatformTip 14: ‘Template Screens’ - another way to start from a proven layout instead of building menu screens from scratch.
🔸 #PowerPlatformTip 55: ‘Picking Colors’ - apply consistent theme colors to the gallery template you just built.
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).