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?
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.
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.
WarrenBelz
146,635
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional