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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Canvas App - Dynamic G...
Power Apps
Unanswered

Canvas App - Dynamic Gallery Assistance.

(0) ShareShare
ReportReport
Posted on by 4
Good Day,
 
Need some assistance with configuring a layout in a canvas app. I have a gallery, with three containers,  each container has different types inputs (ie container 1 shows radio buttons, container two has text etc.) and would want to have their visibility changed based on a gallery item's property. I have tried a few things but for some reason I can't get the visible property to trigger correctly. I'm not sure if my code is incorrect or I'm not understanding how Power Apps deals with these visibility changes.
 
So for example, I have a gallery called "itemGallery", the items have the attributes of Name,Type,Owner. So in the container visibility I have the code as IF(ThisItem.Type = 0,true,false). The intention is that any item that matches type 0, that container shows and for the other two containers that have IF(ThisItem.Type = 1,true,false) and IF(ThisItem.Type = 2,true,false) they have their visible set to false and don't show. However this doesn't work, as no container shows.
 
 
I'm also curious if I can set the container's height like this as well by setting the Height property to be IF(ThisItem.Type = 0, 80,0)
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,040 Most Valuable Professional on at
    Assuming that Type is a numeric field and the container is inside the gallery then what you have  - you can shorten the Visible to (you do not need If/true/false )
    ThisItem.Type = 0
    then it should work. If however the container is outside the gallery, you need
    GalleryName.Selected.Type = 0
    and yes, you could use the same logic for the height.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • Anubis XVII Profile Picture
    4 on at
     
    The field Type , is of the Data Type "Choice" in the Dataverse table, checking on the choices in the table, they had a value of 0,1,2 so that's why I used the numeric function for the condition. Was that the correct choice?
  • WarrenBelz Profile Picture
    153,040 Most Valuable Professional on at
    Whatever the choice you are looking for - however I do not use Dataverse (I am SharePoint only - if you state your data source type in your initial post, you will get the right people responding). This article may be of assistance.
  • Verified answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Hi
     

    1. Visibility Setup

    You’re on the right track by using IF(ThisItem.Type = X, true, false). However, ensure that:
    • The Type attribute is correctly defined.
    • The syntax for setting visibility is appropriate.
    Here's how you can structure it:
    If(ThisItem.Type = 0, true, false)
    For each container:
    • Container1.Visible := IF(ThisItem.Type = 0, true, false)
    • Container2.Visible := IF(ThisItem.Type = 1, true, false)
    • Container3.Visible := IF(ThisItem.Type = 2, true, false)
    Make sure the Type values are correct and match exactly with what is in your data source.
    2. Height Setup
    Similarly, for setting the height, you can use:
    If(ThisItem.Type = 0, 80, 0)
    For each container:
    • Container1.Height := IF(ThisItem.Type = 0, 80, 0)
    • Container2.Height := IF(ThisItem.Type = 1, 80, 0)
    • Container3.Height := IF(ThisItem.Type = 2, 80, 0)
    Troubleshooting Steps:
    • Verify Data Type: Ensure that Type is set as a number or a choice that corresponds to 0, 1, and 2.
    • Check Gallery Selection: Ensure that ThisItem refers correctly to the selected gallery item.
    • Test Visibility and Height Separately: Try setting visibility and height separately to ensure each one works as expected.
    • Performance Consideration: Ensure that complex conditions don't impact the app's performance significantly.


      Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard