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 / OnSelect Button, make ...
Power Apps
Answered

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

(0) ShareShare
ReportReport
Posted on by 920 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:
I have the same question (0)
  • Verified answer
    KiranKhanvilkar Profile Picture
    26 on at

    @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.

     

  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard