Skip to main content
Community site session details

Community site session details

Session Id : QMIhwz6ELLensLguPZhw2W
Power Apps - Building Power Apps
Answered

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

Like (0) ShareShare
ReportReport
Posted on 6 Sep 2023 15:31:38 by 911 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,716 Super User 2025 Season 2 on 06 Sep 2023 at 16:01:00
    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 06 Sep 2023 at 15:56:26
    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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473