web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard