How to Create an Auto Scrolling Gallery in Power Apps

Over the past few months, we have developed several helpful apps in Power Apps, including Leave Management, Travel Requests, and User Login. I wanted to display all of them in one place, and cleanly.

So, I created a gallery that scrolls automatically and displays each app one by one in a Power Apps canvas app. This helps us show our work to clients, allows our team to keep track, and also informs employees about the available apps.

In this tutorial, I will show you how to create an auto scrolling gallery in Power Apps with examples..

Power Apps Auto Scroll Gallery

In the example below, you can see that the images of the developed products are scrolled automatically one by one in the Power Apps gallery. Once it is over, it starts again from the beginning.

automatically scroll gallery control in powerapps

For this example, I stored all my product images and their details in the SharePoint document library.

how to build autoscroll in power apps gallery

This library contains the following fields!

Column NameData Type
NameDefault Column
IDDefault Column
Product DescriptionMultiple lines of text
Follow the steps below to achieve this!
  1. Add the SharePoint document library to the Power Apps application.
  2. Add the code below to the OnVisible property of the screen.
Set(currentIndex, 1);
ClearCollect(colProducts,'Our Power Platform Products')

Here, I set the value of the currentIndex variable to 1, which is used to track the current image, and created a collection to store document library items to avoid delegation issues.

  1. Add a horizontal gallery and update its properties with the values below.
Items= 'Our Power Platform Products'
Default = LookUp('Our Power Platform Products',ID = currentIndex)
Width= Parent.Width
TemplateSize= Parent.Width

Then, add an image control to this gallery and set its Image property to the code below.

ThisItem.Thumbnail.Large

To display the name and description of the product, add text labels and provide the formulas below in its Text property.

Title = ThisItem.Name
Description = ThisItem.'Product Description'
How to build an Auto Scrollable Gallery Control in Power Apps
  1. Insert a Timer control and configure the following properties.
Name = tmrCarouselTimer 
Duration = 3000 
Repeat = true 
AutoStart = true 
Start = true 
OnTimerEnd = Set(currentIndex, If(currentIndex = CountRows(colProducts), 1, currentIndex + 1));

Here, colProducts is the collection that stores the document library items.

scroll the gallery to the end of the gallery

Save the changes and preview the app, so after every three seconds, the images within the Power Apps gallery will scroll automatically.

Power Apps Auto Scroll Gallery with Dot Indicator

Till now, we have seen how to build an auto-scrolling Power Apps gallery. In this section, I will additionally explain how to use indicators to track which item is currently scrolling in the Power Apps gallery.

In the example below, you can see that while scrolling, once the images are over, it starts from the beginning.

power apps auto scroll gallery with dot indicator

To achieve this, follow the steps below!

  1. Add another horizontal gallery and provide the below code in its Items property.
'Our Power Platform Products'

‘Our Power Platform Products’ is the SharePoint document library name.

PowerApps galleries how to auto scroll
  1. Within the gallery, add a Circle icon and set its Fill property to the following formula.
Fill= If(ThisItem.id = currentIndex, Color.SkyBlue, Color.Gray)

Here, we are using an if condition to provide different fill colors to the circle icon. The condition is that if the current image [ThisItem] index and the current ID match, then we apply the sky blue color; otherwise, we use the grey color for the remaining images.

How to make an Auto Scrolling Gallery Control in Power Apps

Save the changes and preview the app. Now, you can see that when the images scroll automatically, the dots’ fill color changes, indicating the current image.

I hope you found this article helpful!

In this article, I have explained how to build an auto scrolling gallery in Power Apps. Additionally, I explained how to display the indicators while the images are scrolling in the Power Apps gallery automatically. Do let me know if you still have any questions.

Also, you may like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…