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 / Use of SVGs of a colle...
Power Apps
Unanswered

Use of SVGs of a collection in a gallery

(0) ShareShare
ReportReport
Posted on by 235

Hello, I am displaying SVGs in a gallery. To manage these SVGs centrally, I have defined them as variables in App OnStart.

 

Example of one SVG:

Set(HomeSVG, "<svg viewBox='0 0 2048 2048' xmlns='http://www.w3.org/2000/svg'><path d='M1024 165l941 942-90 90-83-82v805h-640v-640H896v640H256v-805l-83 82-90-90 941-942zm640 1627V987l-640-640-640 640v805h384v-640h512v640h384z' fill='#000000'></path></svg>")

 

To show this SVG in an image control, I use the following code. This works perfect.

"data&colon;image/svg+xml;utf8, "&EncodeUrl(HomeSVG)

 

I have now put together several SVGs in a collection.

ClearCollect(CollectionSVG,
 {
 Label: "Home",
 ImageSVG: HomeSVG
 },
 {
 Label: "Main",
 ImageSVG: MainSVG
 },
 {
 Label: "Chart",
 ImageSVG: ChartSVG
 }
)

 

Now I want to use a gallery to show this collection. Data source of the gallery is "CollectionSVG". For the image control of the gallery I use the following code:

"data&colon;image/svg+xml;utf8, "&EncodeUrl(ThisItem.ImageSVG)

 

The label text is shown correctly. The image control is empty (no error). If I change the code of the image control to ...

"data&colon;image/svg+xml;utf8, "&EncodeUrl(HomeSVG)

... all image controls of the gallery show the HomeSVG.

 

Why does "ThisItem.ImageSVG" does not work. Where is my error?

 

Thanks for your help.

 

Best regards,

Michael

Categories:
  • SoloMik Profile Picture
    5 on at

    Hi Michael,

     

    you don't need to save the svg String in a separate variable. Save the svg String in your Collection "ImageSVG".

    Than write in the Image propertie "data&colon;image/svg+xml," &
    EncodeUrl(ThisItem.ImageSVG)".

     

    Sorry for my english.

     

    Best regards,

    Muza

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
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard