web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change the colour of d...
Power Apps
Unanswered

Change the colour of data cards depending on other data cards

(0) ShareShare
ReportReport
Posted on by

hi all,

 

i’m currently doing a week-long internship in a project management department. i have been tasked with creating an app that connects to a list on sharepoint that contains information about equipment the organisation owns (what the item is, where it’s located, etc.). so far i have created a main page using a gallery that contains the names of the items along with a search bar and barcode scanner to further help people find information about an item. this then takes you to a second page that displays all the information about that item. 

 

on this second page, i used containers containing data cards and labels to display the information which is set out something like this:

 

                         Item Details

Item                                              [item name]
….

                            Location

Building                                   [building name]

….

 

i have also created a function that makes data cards invisible if there is no information available about a specific topic. 

 

what i would like to do is have the data card background colours be alternating between white and grey (for readability purposes). to do this i wanted to use the relative Y value of the data card (whether it’s odd or even and assign the colour based on that). however i can’t find a way to reference it, and my function instead references the actual Y value. another element of complexity is figuring out if the previous data card is visible or hidden as the function assigning colours that i created does not yet take that into account and so two relative Y values that are both even, for example, may be next to each other meaning they would both be assigned the same colour and would not be alternating. so i guess what i’m asking is:

 

1. is there a way to reference the relative y value instead of the y position on the screen

2. how can i check which of the data cards is the one that is visible above the current data card

 

if anyone can offer any advice or solutions it would be much appreciated.

 

thanks,

Nadia

 

Categories:
  • narayan225 Profile Picture
    2,547 Moderator on at

    @DarlingDracula_ 

     

    You can set a static value for one control and use that value in a formula to place another control.

    narayan225_0-1689902397793.png

    In terms of detecting if they are on top of each other, I guess and I have not tried this, you can reference the X and Y value with a logic.

    For alternating the colours, you can use a variable to do that. In the following example, I have set a variable in onChange property of a control.

    Set(dataCardFill,Color.LightGray)

    And I have applied this variable on a different data card. So, when someone changes one data card, the color of another data card changes.

    narayan225_1-1689902594840.png

     

    Hope this helps in some way.

    Cheers!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard