Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

OnSelect Button, make browsegallery visible and current visible gallery invisible.

(0) ShareShare
ReportReport
Posted on by 909 Super User 2024 Season 1

Hi,

 

I have an onselect button.  I want to make a gallery called "compact_view" invisible and make browsegallery1 visible. And on select again, reverse that.

 

Is tht possible to do?

Categories:
  • Rajkumar_M Profile Picture
    3,631 Super User 2025 Season 1 on at
    Re: OnSelect Button, make browsegallery visible and current visible gallery invisible.

    Hi @wonka1234 

     

    Add two galleries to your PowerApps screen: "compact_view" and "browsegallery1".

     

    In the OnSelect event of your button, add the following code:

     

    If(isCompactView,
    UpdateContext({isCompactView: false}),
    UpdateContext({isCompactView: true})
    )

    This code checks the current state of the toggle variable. If it is true, it sets it to false, and vice versa.

     

    Set the Visible property of the "compact_view" gallery to isCompactView and the Visible property of the "browsegallery1" gallery to !isCompactView. This will make the "compact_view" gallery visible when isCompactView is true and make the "browsegallery1" gallery visible when isCompactView is false.

     

    By toggling the OnSelect button, the state of the toggle variable isCompactView will change, which in turn will control the visibility of the galleries.

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Verified answer
    KiranKhanvilkar Profile Picture
    26 on at
    Re: OnSelect Button, make browsegallery visible and current visible gallery invisible.

    @wonka1234 

     

    You can achieve this using context variable. Create a context variable when you click on Button. Add below code for Button OnSelect property.

     

    UpdateContext({togglevalue: !togglevalue})

     

    Then use below code for browsegallery1 visible property 

    If(togglevalue,false,true)

     

    and use below code for compact_view visible property.

    If(togglevalue,true,false) 

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up.

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,635 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard