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

Community site session details

Session Id : AOkTtaKYKoQcgR42bGIPJ/
Power Apps - Building Power Apps
Answered

Date OnSelect make a label visible

Like (0) ShareShare
ReportReport
Posted on 15 Aug 2017 07:44:22 by 119

All,

 

I have a gallery on the left hand side and when someone presses a button outside of the gallery - I want an label to become visible on the gallery. But only on the gallery item that was selected. 

 

I can find Gallery1.selected , but I tried to update the context on that. I added a variable to the visible object. This doesnt seem to work. 

 

Any ideas - just to make a label visible on the selected gallery item. 

 

Thanks, Jason. 

 

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on 19 Jun 2019 at 13:16:02
    Hallo guys , Ι would like to make the Card after the Buttons Invisible when Both Buttons are off. And Visible when AT LEAST ONE OF THEM IS ON. Is something like that possible? thank you very much

    Quetion.PNG

  • Verified answer
    nickduxfield Profile Picture
    497 on 22 Aug 2017 at 08:00:08
    Re: Date OnSelect make a label visible

    To simplify if you need to add more and more galleies, try the reverse.

    • Create a global variable to cross screens on the first screen's OnStart: UpdateContext:({Gallery1LabelVisible:false})
    • For the screen with the gallery button or label. Edit the OnVisible: UpdateContext:({Gallery1LabelVisible:false}). ( Assuming you want the Galley and the external button on the same screen. If they are on different screens, you will have to remove that OnVisible code.
    • For the button or Label outside of the gallery. Edit the Text field to: If(Gallery1LabelVisible=false,"Gallery item UnSelected","Galley item Selected") etc. To trigger the label in the gallery If(Gallery1LabelVisible=false, UpdateContext:({Gallery1LabelVisible:true}),UpdateContext:({Gallery1LabelVisible:false}). Now if you click the external button, and then a gallery item, text will appear.
    • For the button that you can add in the galley. Go for full width with Parent.Width. Then you can use that as a label and a button. For its Text field: if(ThisItem.IsSelected&&Gallery1Label=true,"IsSelected text","IsUnSelected text"). Then go for the OnSelect: If(Gallery1LabelVisible=false, UpdateContext:({Gallery1LabelVisible:true}),UpdateContext:({Gallery1LabelVisible:false}). To toggle this effect add the same code that you used on the external button. OnSelect: If(Gallery1LabelVisible=false, UpdateContext:({Gallery1LabelVisible:true}),UpdateContext:({Gallery1LabelVisible:false})

    That will do somethign like the following.

    If an item in the galley is not selected It will present false text on a label anywhere due to a global variable.

    If an item in the gallery is selected the text in both the gallery and the external label will produce true text.

     

    Some things to think about.

    Galleries depending on your filter rules and the default rule will always have something selected.

    If you are using multiple screens you need a global variable.

    You can have a toggle efeect.

    You can create a simple variable instead of multple UpdateContext for each item. Then add if statements on the controls. For example: Visible: If(GlobalVariable=true,true,false). Size: If(GlobalVariable=true,21,16) X or Y: If(GlobalVariable=true,88,400)

  • Jason_Hough Profile Picture
    119 on 21 Aug 2017 at 12:38:29
    Re: Date OnSelect make a label visible

    This works correctly but I want the 'visible' to remain when the user presses another gallery item. I dont want it to disapear and another one shows, i want them both to show. Any ideas ? Thanks in Advance.

  • nickduxfield Profile Picture
    497 on 16 Aug 2017 at 11:17:25
    Re: Date OnSelect make a label visible

    Add the image in the ediable area of the gallery card. Add some code to the "Visible" control fields of the related items.

    If(ThisItem.IsSelected,'Image',false). You may add other images. To have a label pop outside of the gallery, try a variable.

    If(ThisItem.IsSelected,UpdateContext({PopupLabel:false,GalleryImage:true}),updateContext({PopupLabel:true,GalleryImage:false}))

    You need to now put the variable in the popuplabel's visible control fields after you get the code setup otherwise everything will disappear. If that happens, delete all the code and set all 'Visible' cards images and labels 'true'.

  • v-micsh-msft Profile Picture
    on 16 Aug 2017 at 07:47:43
    Re: Date OnSelect make a label visible

    Hi @Jason_Hough,

     

    We could achieve it by changing the formula under the Visible property of the Label in the gallery as below:

    If(BrowseGallery1.Selected.ID=ThisItem.ID&&Variable1=true,true,false)

    Then under the Button OnSelect property, copy and paste the code below:

    UpdateContext({Variable1:true})

    Once button has been pressed, the Label would be shown only when the item has been selected from the Gallery.

    Regards,

    Michael

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 752 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 472

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 358 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete