Using Icons and Images in Apps

Loading

πŸ”Ή Using Icons and Images in Power Apps – A Complete Guide

πŸ“Œ Introduction

Icons and images play a crucial role in making a Power Apps application visually appealing, user-friendly, and easy to navigate. Power Apps allows you to use built-in icons, upload images, and dynamically fetch images from data sources.

βœ… Why Use Icons & Images?

  • 🎨 Enhances UI/UX with visual elements.
  • πŸš€ Improves navigation with intuitive icons.
  • πŸ”„ Dynamically updates images from databases or APIs.

πŸ”Ή Step 1: Adding Built-in Icons

Power Apps provides a library of built-in icons like search, delete, edit, and more.

βœ… Adding an Icon

1️⃣ Go to Insert β†’ Select Icons
2️⃣ Choose an icon (e.g., Search, Edit, Delete, Home)
3️⃣ Resize and position the icon as needed

βœ… Customizing Icon Properties

  • Change Color
Icon1.Color = RGBA(0, 122, 255, 1) // Blue Color
  • Change Size
Icon1.Width = 50
Icon1.Height = 50
  • Change Visibility
Icon1.Visible = User().Email = "admin@company.com"

πŸ“Œ This makes the icon visible only for admins!


πŸ”Ή Step 2: Adding Images to Your App

βœ… Uploading an Image

1️⃣ Click Insert β†’ Select Image
2️⃣ In the Image Property, click Add Image File
3️⃣ Select an image from your computer

πŸ“Œ Now, the image appears in your app!

βœ… Setting an Image Dynamically from a URL

  • If images are stored online, use the Image property:
Image1.Image = "https://www.example.com/myimage.png"

πŸ“Œ Now, the image will load from the web!


πŸ”Ή Step 3: Using Images from a Data Source

βœ… Example: Displaying a User’s Profile Picture from SharePoint or Dataverse
1️⃣ Connect to a data source (e.g., SharePoint, Dataverse, SQL Server).
2️⃣ Bind the image control to the image field in your data source:

Image1.Image = LookUp(UserProfileTable, Email = User().Email).ProfilePicture

πŸ“Œ This fetches the user’s profile picture dynamically!

βœ… Example: Showing Product Images in a Gallery
1️⃣ Add a Gallery β†’ Select a Data Source with images.
2️⃣ Insert an Image Control inside the Gallery.
3️⃣ Set the Image property to:

ThisItem.ProductImage

πŸ“Œ Now, each product displays its own image!


πŸ”Ή Step 4: Using Icons for Navigation

βœ… Example: Adding a Home Button
1️⃣ Insert a Home Icon
2️⃣ Set the OnSelect property:

Navigate(HomeScreen, ScreenTransition.Fade)

πŸ“Œ Now, clicking the icon returns to the Home Screen!

βœ… Example: Adding a Delete Button with Confirmation
1️⃣ Insert a Trash Icon
2️⃣ Set the OnSelect property:

If(
   Confirm("Are you sure you want to delete this item?"),
   Remove(DataSourceName, ThisItem)
)

πŸ“Œ Now, clicking the icon deletes an item after confirmation!


πŸ”Ή Step 5: Displaying Images from OneDrive or SharePoint

βœ… Example: Displaying an Image from OneDrive
1️⃣ Store images in OneDrive
2️⃣ Get the image URL and store it in a database
3️⃣ Set the Image property:

Image1.Image = "https://onedrive.live.com/embed?resid=" & ThisItem.ImageURL

πŸ“Œ Now, the image loads from OneDrive!

βœ… Example: Fetching an Image from SharePoint
1️⃣ Store images in a SharePoint Library
2️⃣ Use a Gallery and bind the image field:

Image1.Image = ThisItem.FileLink

πŸ“Œ Now, SharePoint images are dynamically displayed!


πŸ”Ή Step 6: Using Conditional Formatting on Icons & Images

βœ… Example: Changing Icon Color Based on Status

  • If a task is complete, show a green check; otherwise, show red:
Icon1.Color = If(ThisItem.Status = "Complete", Green, Red)

πŸ“Œ Now, icons dynamically change color based on the task status!

βœ… Example: Displaying Different Images Based on Conditions

If(
   ThisItem.Type = "Admin", 
   "https://example.com/admin.png", 
   "https://example.com/user.png"
)

πŸ“Œ Now, different images are shown for admin and regular users!


πŸ”Ή Step 7: Optimizing Performance When Using Images

βœ… Use Small Image Files

  • Upload compressed images to prevent slow loading.

βœ… Use Cached Images

  • Store frequently used images in Power Apps Media Library.

βœ… Lazy Load Images

  • Load images only when needed to improve app speed.
If(Gallery1.Selected, Image1.Visible = true, false)

πŸ“Œ This prevents unnecessary image loading!


πŸ”Ή Conclusion

Using icons and images in Power Apps helps in improving the UI, navigation, and user experience.

πŸ’‘ Key Takeaways:
βœ… Use built-in icons for navigation and actions.
βœ… Upload custom images or fetch them from data sources.
βœ… Bind images dynamically to galleries and lists.
βœ… Implement conditional formatting for dynamic UI.
βœ… Optimize performance by caching and lazy loading images.

Now, you’re ready to enhance your Power Apps with icons and images!


Leave a Reply

Your email address will not be published. Required fields are marked *