cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_kikilalaaa
Helper V
Helper V

2 gallery in 1 screen that alternate visible

Hi experts!

I have 2 gallery in my powerapps. By default, gallery A will be displayed to user when they are directed to the screen. When they click any options in Gallery A, the Gallery A will become invisible and Gallery B will become visible and display certain items based on option selected in Gallery A, and it is at the same position as Gallery A just now. How to do that? As for now, what i did was:

 

GalleryB.Visible --> GalleryA.Visible = false

GalleryA.OnSelect --> GalleryB.Visible

 

but it has errors on GalleryA.OnSelect.

Please help!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @_kikilalaaa ,

 

I did a simple test for you.

1\ Set the OnSelect property of ‘Gallery1’ control to:

Set(Thevar,!Thevar)

 

Set the Visible property of ‘Gallery1’ control to:

Thevar

 

2\ Set the OnSelect property of ‘Gallery2’ control to:

Set(Thevar,!Thevar)

 

Set the Visible property of ‘Gallery2’ control to:

Thevar

 

3\ The result is as follows:

2.PNG

AAA.gif

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

5 REPLIES 5
Drrickryp
Super User
Super User

You would use UpdateContext() to create a variable when the option is selected.

 

UpdateContext({var:false})

 

in the OnVisible property of the screen.

in the control that selects an option (say a checkbox), the OnCheck property would be 

 

UpdateContext({var:true})

 

 You would set the Visible property of GalleryA to !var and the Visible property of GalleryB to var

To toggle between the galleries, you could put the icon with up and down arrows and make its OnSelect property

UpdateContext({var:!var})

Hi @Drrickryp , I have tried your solution.

1. My gallery A property are as follow:

Gallery A. Visible = varvisible

Gallery A. OnSelect = UpdateContext({varvisible:false})

 

GalleryB. Visible = !varvisible

 

However, when I run and select anything from Gallery A, Gallery A does not disappear, and Gallery B does not appear.

 

For your information, my gallery is a vey simple gallery that display items from SharePoint List. My gallery A looks like this :

_kikilalaaa_0-1612460129485.png

 

Try putting the UpdateContext({varvisible:false}) in the OnSelect property of the  ">" icon in GalleryA instead of in the OnSelect property of the gallery itself.  Also to troubleshoot, put a button on the screen outside either gallery and make its Onselect property UpdateContext({varvisible:!varvisible}) and click it a few times to see what happens.

Hi, I have tried your solution. It seems like the Gallery A doesnt works out when it is selected. Because when I select at the ">" icon, I still cannot go to Gallery B because the varvisible still true.

 

I have used button and label to check. It works perfectly when I clicked the button. where things could go wrong hmm

 

_kikilalaaa_0-1612462000126.png_kikilalaaa_1-1612462027231.png

 

v-xiaochen-msft
Community Support
Community Support

Hi @_kikilalaaa ,

 

I did a simple test for you.

1\ Set the OnSelect property of ‘Gallery1’ control to:

Set(Thevar,!Thevar)

 

Set the Visible property of ‘Gallery1’ control to:

Thevar

 

2\ Set the OnSelect property of ‘Gallery2’ control to:

Set(Thevar,!Thevar)

 

Set the Visible property of ‘Gallery2’ control to:

Thevar

 

3\ The result is as follows:

2.PNG

AAA.gif

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,025)