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 II
Super User II

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,142)