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 / Gallery Items shows up...
Power Apps
Answered

Gallery Items shows up when I click button and then disappear

(0) ShareShare
ReportReport
Posted on by 45

I have 2 buttons and a gallery in my app screen. The functionality is like follows:

If button 1 is selected then gallery should show items from list1

And if button 2 is selected gallery should show items from list 2

For this I have a function on gallery's items property

If(Button1_4.Pressed,Distinct(GalVar,Resource_Group_Name),If(Button1_5.Pressed,Distinct(AzVar,ResourceName)))

 

Now th issue is that, When I click button 1, items appear in gallery but they disappear quickly and same behaviour is with button 2.

How to fix it?

zainab1_1-1687339051060.png

 

Categories:
  • Verified answer
    cha_cha Profile Picture
    4,932 Moderator on at

    Hello @zainab1 

     

    Pressed is when the user momentarily was holding the button down the Mouse button key. Alternatively, what you can do is this:

     

    On Button1's OnSelect property, have this code:

    Set(varButtonSelected,1);

     

    On Button2's OnSelect property, set this:

    Set(varButtonSelected,2);

     

    Then on your Gallery's Items List:

    Switch(varButtonSelected
     ,1,Distinct(GalVar,Resource_Group_Name)
     ,2,Distinct(AzVar,ResourceName)
     ,Blank()
    );
  • zainab1 Profile Picture
    45 on at

    It worked 😀

    Thanks alot!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard