How to Keep Power Apps Gallery Items Green After Reloading
Question details
The user needs to maintain the green selection color of specific items in a Power Apps gallery persistently across screen or app reloads.

- Product
- Microsoft Power Apps
- Device & OS
- not provided
- Scenario
- Building a Power App where users select items from a gallery, and the visual selection state needs to remain visible upon navigating away and returning.
- Observed behavior
- The selected name changes to green, but the visual state resets to default when the app or screen is reloaded without persistent tracking.
Ensure you have edit permissions for your Power App and are familiar with writing basic Power Fx formulas for Collections and Gallery properties.
Use Collections to Persist and Restore Selection State
Track selected records using a collection to persist the selection state, and apply conditional formatting to the gallery items based on the collection's data.
By default, gallery selections are temporary and will reset upon screen reloads. To make a selection persistent across the application, you must store the selected item's identifier in a collection or data source and use it to define the gallery item's color dynamically.
On your app's OnStart property or the screen's OnVisible property, use the ClearCollect function to initialize a collection or load previously saved selections from your data source.
Select the element inside your gallery that triggers the selection. Set its OnSelect property to add the item to your collection using a formula like Collect(MySelectedItems, ThisItem).
Select the gallery template. Change the TemplateFill or Color property to check the collection and apply the green color: If(ThisItem.ID in MySelectedItems.ID, Color.Green, Color.Transparent).

Looking for a Lightweight Alternative for Everyday Office Tasks?
While specialized app development is handled by tools like Power Apps, your daily document management can be vastly improved with WPS Office. It provides a comprehensive, lightweight suite for editing documents, spreadsheets, and presentations seamlessly.
- 1. Download and Install: Visit the official WPS Office website to download the free installer for your operating system.
- 2. Open Microsoft Formats: Double-click any existing .docx, .xlsx, or .pptx file to open and edit them seamlessly in WPS Office without formatting loss.
- 3. Save and Export: Save your work in standard Office formats to collaborate with Microsoft users, or export directly to PDF with a single click.

Frequently Asked Questions
Why does my Power Apps gallery selection disappear when changing screens?
Power Apps gallery states are tied to the active screen. Navigating away and back resets the gallery's internal properties, causing you to lose the visual selection unless the data is saved globally in a variable, collection, or underlying data source.
Can I toggle the green color on and off when clicking a gallery item?
Yes. In the OnSelect property, you can use an If statement alongside the RemoveIf and Collect functions to check if the item is already in your collection. If it is, remove it to toggle the color off; if not, collect it to toggle the color to green.
How do I save the selected gallery items permanently for the next time I open the app?
Variables and collections are cleared completely when the app closes. To save selections permanently across sessions, you must use the Patch function to write the selected data to a backend persistent data source like SharePoint, SQL, or Dataverse.




