Power Apps

Conditional Formatting in Power Apps Galleries

Use TemplateFill, Visible, Color and accessible status indicators to format Power Apps galleries without invented benchmarks or delegation mistakes.

Collab365 Team · 7 September 2018 · Updated 24 August 2026 · 3 min read

Conditional formatting in a Power Apps gallery is simply a Power Fx formula on a visual property such as TemplateFill, Color, Visible or an icon's properties. The important bit is choosing the right field shape and making the meaning available without relying on colour alone.

This guide uses a SharePoint list with these example columns:

  • Title, single line of text
  • Status, Choice
  • Priority, Choice
  • DueDate, Date and time
  • Amount, Currency

SharePoint Choice fields normally arrive in a canvas app as records, so formulas use ThisItem.Status.Value, not ThisItem.Status. Confirm the actual shape in the formula bar or Collections viewer rather than copying that expression blindly.

Colour a gallery row

Select the gallery and set TemplateFill:

If(
    ThisItem.Status.Value = "Overdue",
    ColorValue("#FDE7E9"),
    Color.Transparent
)

The Gallery control reference documents TemplateFill as the background colour for a gallery template. Keep the selected state visible as well:

If(
    ThisItem.IsSelected,
    ColorValue("#E5F1FB"),
    If(ThisItem.Status.Value = "Overdue", ColorValue("#FDE7E9"), Color.White)
)

Use Switch for one field with several values

Switch is easier to read when one field has several known values:

Switch(
    ThisItem.Priority.Value,
    "High", ColorValue("#A4262C"),
    "Medium", ColorValue("#8A6D1D"),
    "Low", ColorValue("#107C10"),
    ColorValue("#605E5C")
)

Put that formula on an icon or text control's Color property. Include a default value so a renamed or blank choice does not produce an unexplained style.

Show an overdue indicator

Set an icon's Visible property:

!IsBlank(ThisItem.DueDate) &&
ThisItem.DueDate < Today() &&
ThisItem.Status.Value <> "Completed"

Set its AccessibleLabel to a useful description such as:

"Overdue: " & ThisItem.Title

Microsoft's canvas app accessibility guidance recommends accessible labels and sufficient contrast. Pair colour with text or an icon so colour-blind users and screen-reader users receive the same status.

Images and icons

For a small, fixed set of categories, import media into the app and use Switch on an Image control:

Switch(
    ThisItem.Category.Value,
    "Vehicle", imgVehicle,
    "Building", imgBuilding,
    imgDefault
)

Use stable media names, provide accessible text, and confirm that you have rights to redistribute any third-party icon. Microsoft's built-in Shape and Icon controls avoid an external asset dependency for common actions.

Delegation: what the colour formula can and cannot fix

A TemplateFill formula evaluates the records already present in the gallery. The usual data-loss risk lives in the gallery's Items formula. If a nondelegable filter retrieves only a local subset, perfectly correct formatting still cannot show records that were never returned.

Check Filter, Search, LookUp and sort expressions for delegation warnings. Microsoft explains that nondelegable queries process only the first portion of a large data source locally. Raising the row limit is not a complete fix.

Keep formatting maintainable

Repeated colour formulas become difficult to change. For a real app:

  • name colours or expose them through a reusable component
  • keep business rules in one readable formula where possible
  • avoid connector calls inside every gallery row
  • use With to name intermediate values
  • test blanks, unexpected choices and permissions-restricted fields

Copilot can suggest Power Fx, but its output is draft code. Check the field names, data types, delegation and accessible meaning before keeping it.

For more practical Power Apps patterns that stay readable after the first maker leaves, join the Power Apps Builders Space.

Sources