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 / Dynamic Image Name Que...
Power Apps
Answered

Dynamic Image Name Question

(0) ShareShare
ReportReport
Posted on by 987

I have uploaded three images to my Power App (content>media).

ImageA

ImageB

ImageC

 

I have added three buttons to a new screen:

Button 1-A

Button 2-B

Button 3-C

I have added an image control (MyImage) under the buttons.

 

I want to click on the button and make the image change in the image control.

 

So, what I did is created a context value called "SImage" and I'm using it like this:

Button 1-A OnSelect = UpdateContext( { SImage: "ImageA" } )

Button 2-B OnSelect = UpdateContext( { SImage: "ImageB" } )

Button 3-C OnSelect = UpdateContext( { SImage: "ImageC" } )

 

Finally, I added a Textbox Control (IName).

I have set the textbox Name default value to SImage

I have set MyImage Image setting to IName.Text

(because in real life I need this to work even if the user changes screens)

 

When I click on the button the Textbox contents changes as expected, but the image does not show up at all. Can anyone help me out please?

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi Audrieg,

     

    Per my test, if I set the OnSelect property of the button as “UpdateContext( { SImage: ImageA } )” without a double quotation mark on ImageA, it would work.

     

    Please try if this works for you.

     

    Best regards,
    Mabel Mao

  • petsa Profile Picture
    Microsoft Employee on at

    Having almost the same problem ...
    I would like to get the images from URL's instead and change them the same way dynamically in event handlers but could not get it to work for some reason.

     

    Small test:

    on Form "onVisible": UpdateContext( { myimage: "https://3.bp.blogspot.com/-W__wiaHUjwI/Vt3Grd8df0I/AAAAAAAAA78/7xqUNj8ujtY/s1600/image02.png" } ) 

     

    then on the the actual image control I set property: Image=myimage

    => No visible picture.

     

    Then when I use buttons to do the same this , still no image.

    There must a be some syntactical trick to this, right ?

     

    petri.

     

     

     

     

     

  • audrieFCT Profile Picture
    987 on at

    My scenariio completely changed after I updated power apps. The image is working now (the returned value is now a link to the image embedded in the file). However the text value I wanted to be clean for the topic selection is now not working.

     

    Thank you for your help with the picture though!

     

     

  • Verified answer
    rgruian Profile Picture
    Microsoft Employee on at

    Audrie,

     

     

    PowerApps keeps no explicit mapping/association between the names of image resources and their underlying "values" that are referenced in formulas. You will need to maintain that mapping yourself:

     

        Button 1-A OnSelect = UpdateContext( { SImage: "ImageA", Image: ImageA } )

        Button 2-B OnSelect = UpdateContext( { SImage: "ImageB", Image: ImageB } )

        Button 3-C OnSelect = UpdateContext( { SImage: "ImageC", Image: ImageC } )

     

        IName.Text = SImage

        MyImage.Image = Image

     

    I hope this helps.

     

     

  • audrieFCT Profile Picture
    987 on at

    I've got this really weird situation where the returned value for the Topic is fluctuating.....

     

    I'm going to try what you suggested before I spend a lot of time explaining what I mean 🙂

  • audrieFCT Profile Picture
    987 on at

    That worked, and stopped the fluctuation! Thank you!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard